Replace emptyObj with BSONObj()
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
|
||||
using namespace mongo;
|
||||
|
||||
void printIfAge(DBClientConnection& c, int age) {
|
||||
auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", QUERY( "age" << age ).sort("name") );
|
||||
while( cursor->more() ) {
|
||||
BSONObj p = cursor->next();
|
||||
cout << p.getStringField("name") << endl;
|
||||
}
|
||||
void printIfAge(DBClientConnection& c, int age) {
|
||||
auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", QUERY( "age" << age ).sort("name") );
|
||||
while( cursor->more() ) {
|
||||
BSONObj p = cursor->next();
|
||||
cout << p.getStringField("name") << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void run() {
|
||||
@@ -30,7 +30,7 @@ void run() {
|
||||
|
||||
cout << "count:" << c.count("tutorial.persons") << endl;
|
||||
|
||||
auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", emptyObj);
|
||||
auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", BSONObj());
|
||||
while( cursor->more() ) {
|
||||
cout << cursor->next().toString() << endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user