summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-03-19 16:23:04 -0400
committerAaron <aaron@10gen.com>2009-03-19 16:23:04 -0400
commit5a276ef621d94465c474e95dde8b457f878b2bb0 (patch)
tree896d91c1485b187d6a626bbde8cb3439428e55f1 /client
parentfdde87047f33a31a35636de71a02a98bb673ad5b (diff)
downloadmongo-5a276ef621d94465c474e95dde8b457f878b2bb0.tar.gz
Replace emptyObj with BSONObj()
Diffstat (limited to 'client')
-rw-r--r--client/dbclient.cpp9
-rw-r--r--client/dbclient.h4
-rw-r--r--client/examples/authTest.cpp2
-rw-r--r--client/examples/clientTest.cpp4
-rw-r--r--client/examples/second.cpp4
-rw-r--r--client/examples/tutorial.cpp14
-rw-r--r--client/examples/whereExample.cpp4
-rw-r--r--client/gridfs.cpp2
8 files changed, 21 insertions, 22 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp
index 57425730f2e..2cfba890fa7 100644
--- a/client/dbclient.cpp
+++ b/client/dbclient.cpp
@@ -82,12 +82,12 @@ namespace mongo {
}
BSONObj Query::getSort() const {
if ( ! isComplex() )
- return emptyObj;
+ return BSONObj();
return obj.getObjectField( "orderby" );
}
BSONObj Query::getHint() const {
if ( ! isComplex() )
- return emptyObj;
+ return BSONObj();
return obj.getObjectField( "$hint" );
}
bool Query::isExplain() const {
@@ -730,7 +730,6 @@ namespace mongo {
/* ------------------------------------------------------ */
// "./db testclient" to invoke
- extern BSONObj emptyObj;
void testClient3() {
out() << "testClient()" << endl;
// DBClientConnection c(true);
@@ -747,7 +746,7 @@ namespace mongo {
again:
out() << "query foo.bar..." << endl;
auto_ptr<DBClientCursor> cursor =
- c.query("foo.bar", emptyObj, 0, 0, 0, Option_CursorTailable);
+ c.query("foo.bar", BSONObj(), 0, 0, 0, Option_CursorTailable);
DBClientCursor *cc = cursor.get();
if ( cc == 0 ) {
out() << "query() returned 0, sleeping 10 secs" << endl;
@@ -896,7 +895,7 @@ again:
while( 1 ) {
sleepsecs(3);
try {
- log() << "findone returns " << p.findOne("dwight.foo", emptyObj).toString() << endl;
+ log() << "findone returns " << p.findOne("dwight.foo", BSONObj()).toString() << endl;
sleepsecs(3);
BSONObj info;
bool im;
diff --git a/client/dbclient.h b/client/dbclient.h
index f01605dcc5c..ce65f44c495 100644
--- a/client/dbclient.h
+++ b/client/dbclient.h
@@ -56,7 +56,7 @@ namespace mongo {
class Query {
public:
BSONObj obj;
- Query() : obj(emptyObj) { }
+ Query() : obj(BSONObj()) { }
Query(const BSONObj& b) : obj(b) { }
Query(const string &json) :
obj(fromjson(json)) { }
@@ -293,7 +293,7 @@ namespace mongo {
/** count number of objects in collection ns that match the query criteria specified
throws UserAssertion if database returns an error
*/
- unsigned long long count(const char *ns, BSONObj query = emptyObj);
+ unsigned long long count(const char *ns, BSONObj query = BSONObj());
string createPasswordDigest( const char * username , const char * clearTextPassword );
diff --git a/client/examples/authTest.cpp b/client/examples/authTest.cpp
index 78fc57286b6..b027e957d9f 100644
--- a/client/examples/authTest.cpp
+++ b/client/examples/authTest.cpp
@@ -16,7 +16,7 @@ int main() {
}
{ // clean up old data from any previous tests
- conn.remove( "test.system.users" , emptyObj );
+ conn.remove( "test.system.users" , BSONObj() );
}
conn.insert( "test.system.users" , BSON( "user" << "eliot" << "pwd" << conn.createPasswordDigest( "eliot" , "bar" ) ) );
diff --git a/client/examples/clientTest.cpp b/client/examples/clientTest.cpp
index ba2fe90586e..7eb3c7e6f93 100644
--- a/client/examples/clientTest.cpp
+++ b/client/examples/clientTest.cpp
@@ -138,7 +138,7 @@ int main() {
conn.insert( tsns , b.obj() );
}
- mongo::BSONObj out = conn.findOne( tsns , mongo::emptyObj );
+ mongo::BSONObj out = conn.findOne( tsns , mongo::BSONObj() );
unsigned int inc = out["ts"].timestampInc();
{
@@ -152,7 +152,7 @@ int main() {
conn.update( tsns , b1.obj() , b2.obj() );
}
- assert( conn.findOne( tsns , mongo::emptyObj )["ts"].timestampInc() == ( inc + 1 ) );
+ assert( conn.findOne( tsns , mongo::BSONObj() )["ts"].timestampInc() == ( inc + 1 ) );
}
diff --git a/client/examples/second.cpp b/client/examples/second.cpp
index 2afd5736f96..86aba0bcbe7 100644
--- a/client/examples/second.cpp
+++ b/client/examples/second.cpp
@@ -18,12 +18,12 @@ int main() {
const char * ns = "test.second";
- conn.remove( ns , emptyObj );
+ conn.remove( ns , BSONObj() );
conn.insert( ns , BSON( "name" << "eliot" << "num" << 17 ) );
conn.insert( ns , BSON( "name" << "sara" << "num" << 24 ) );
- auto_ptr<DBClientCursor> cursor = conn.query( ns , emptyObj );
+ auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObj() );
cout << "using cursor" << endl;
while ( cursor->more() ) {
BSONObj obj = cursor->next();
diff --git a/client/examples/tutorial.cpp b/client/examples/tutorial.cpp
index b585af64fed..7720e6fcaa3 100644
--- a/client/examples/tutorial.cpp
+++ b/client/examples/tutorial.cpp
@@ -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;
}
diff --git a/client/examples/whereExample.cpp b/client/examples/whereExample.cpp
index a4d04bda1e3..2f83af6ea1f 100644
--- a/client/examples/whereExample.cpp
+++ b/client/examples/whereExample.cpp
@@ -18,12 +18,12 @@ int main() {
const char * ns = "test.where";
- conn.remove( ns , emptyObj );
+ conn.remove( ns , BSONObj() );
conn.insert( ns , BSON( "name" << "eliot" << "num" << 17 ) );
conn.insert( ns , BSON( "name" << "sara" << "num" << 24 ) );
- auto_ptr<DBClientCursor> cursor = conn.query( ns , emptyObj );
+ auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObj() );
while ( cursor->more() ) {
BSONObj obj = cursor->next();
diff --git a/client/gridfs.cpp b/client/gridfs.cpp
index 154cc034bd2..3c84e6cbcc3 100644
--- a/client/gridfs.cpp
+++ b/client/gridfs.cpp
@@ -107,7 +107,7 @@ namespace mongo {
}
auto_ptr<DBClientCursor> GridFS::list(){
- return _client.query( _filesNS.c_str() , emptyObj );
+ return _client.query( _filesNS.c_str() , BSONObj() );
}
auto_ptr<DBClientCursor> GridFS::list( BSONObj o ){