mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
$orderby must be -1 or 1. The latest MongoDB release throws an error when using 0.
This commit is contained in:
@@ -234,7 +234,7 @@ void sample5(Poco::MongoDB::Connection& connection)
|
||||
|
||||
// When orderby is needed, use 2 separate documents in the query selector
|
||||
cursor.query().selector().addNewDocument("$query").add("birthyear", 1987);
|
||||
cursor.query().selector().addNewDocument("$orderby").add("lastname", 0);
|
||||
cursor.query().selector().addNewDocument("$orderby").add("lastname", -1);
|
||||
|
||||
Poco::MongoDB::ResponseMessage& response = cursor.next(connection);
|
||||
while(1)
|
||||
@@ -410,7 +410,7 @@ void sample11(Poco::MongoDB::Connection& connection)
|
||||
|
||||
if ( response.hasDocuments() )
|
||||
{
|
||||
std::cout << "Count: " << response.documents()[0]->get<double>("n") << std::endl;
|
||||
std::cout << "Count: " << response.documents()[0]->get<int>("n") << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user