Created
October 4, 2011 10:54
-
-
Save choplin/1261347 to your computer and use it in GitHub Desktop.
how to use _addSpecial command via c++ driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BSONObjBuilder b; | |
b.append( "query", BSONObj() ); // append original BSON object of query | |
b.append( "$maxScan", 1 ); // append special parameter | |
auto_ptr<DBClientCursor> cursor = c.query( ns, Query(b.obj()) ); | |
while( cursor->more() ){ | |
BSONObj p = cursor->next(); | |
cout << p.toString() << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
forget to add
DBClientConnection c;
c.connect("localhost");