Skip to content

Commit

Permalink
fix sorting method
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnermoschini committed Sep 9, 2014
1 parent b36015f commit b983c87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ std::string DLAPI::Collection::getQuery()

// Sorting
if (ordering.size() > 0) {
str = str.append(", s: [");
str = str.append(", \"s\": [");
for (int i = 0; i < ordering.size(); i++)
{
std::pair<std::string, SortingOption> p = ordering[i];
if (i != 0) str = str.append(",");
std::string key = p.first;
std::string val = p.second == Ascending ? "ASC" : "DESC";
std::string val = p.second == Ascending ? "asc" : "desc";
str = str.append(DLAPI::Str::format("[\"%s\",\"%s\"]", key.c_str(), val.c_str()));
}
str = str.append("]");
}

str = str.append("}");
Expand Down

0 comments on commit b983c87

Please sign in to comment.