summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/dbclient.cpp10
-rw-r--r--client/examples/clientTest.cpp44
-rw-r--r--client/examples/first.cpp10
-rw-r--r--client/gridfs.cpp6
-rw-r--r--client/model.cpp4
5 files changed, 37 insertions, 37 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp
index ddefc817065..10eba7050b9 100644
--- a/client/dbclient.cpp
+++ b/client/dbclient.cpp
@@ -34,7 +34,7 @@ namespace mongo {
BSONObjBuilder b;
b.appendElements(obj);
b.appendWhere(jscode, scope);
- obj = b.doneAndDecouple();
+ obj = b.obj();
return *this;
}
@@ -45,7 +45,7 @@ namespace mongo {
else
b.append("query", obj);
b.append("orderby", s);
- obj = b.doneAndDecouple();
+ obj = b.obj();
return *this;
}
@@ -56,7 +56,7 @@ namespace mongo {
else
b.append("query", obj);
b.append("$hint", keyPattern);
- obj = b.doneAndDecouple();
+ obj = b.obj();
return *this;
}
@@ -67,7 +67,7 @@ namespace mongo {
else
b.append("query", obj);
b.append("$explain", true);
- obj = b.doneAndDecouple();
+ obj = b.obj();
return *this;
}
@@ -520,7 +520,7 @@ namespace mongo {
return 0;
_seenIndexes.insert( cacheKey );
- insert( Namespace( ns.c_str() ).getSisterNS( "system.indexes" ).c_str() , toSave.doneAndDecouple() );
+ insert( Namespace( ns.c_str() ).getSisterNS( "system.indexes" ).c_str() , toSave.obj() );
return 1;
}
diff --git a/client/examples/clientTest.cpp b/client/examples/clientTest.cpp
index b3136272732..36288da4d3f 100644
--- a/client/examples/clientTest.cpp
+++ b/client/examples/clientTest.cpp
@@ -25,22 +25,22 @@ int main() {
conn.dropCollection(ns);
// clean up old data from any previous tests
- conn.remove( ns, BSONObjBuilder().doneAndDecouple() );
- assert( conn.findOne( ns , BSONObjBuilder().doneAndDecouple() ).isEmpty() );
+ conn.remove( ns, BSONObjBuilder().obj() );
+ assert( conn.findOne( ns , BSONObjBuilder().obj() ).isEmpty() );
// test insert
- conn.insert( ns ,BSONObjBuilder().append( "name" , "eliot" ).append( "num" , 1 ).doneAndDecouple() );
- assert( ! conn.findOne( ns , BSONObjBuilder().doneAndDecouple() ).isEmpty() );
+ conn.insert( ns ,BSONObjBuilder().append( "name" , "eliot" ).append( "num" , 1 ).obj() );
+ assert( ! conn.findOne( ns , BSONObjBuilder().obj() ).isEmpty() );
// test remove
- conn.remove( ns, BSONObjBuilder().doneAndDecouple() );
- assert( conn.findOne( ns , BSONObjBuilder().doneAndDecouple() ).isEmpty() );
+ conn.remove( ns, BSONObjBuilder().obj() );
+ assert( conn.findOne( ns , BSONObjBuilder().obj() ).isEmpty() );
// insert, findOne testing
- conn.insert( ns , BSONObjBuilder().append( "name" , "eliot" ).append( "num" , 1 ).doneAndDecouple() );
+ conn.insert( ns , BSONObjBuilder().append( "name" , "eliot" ).append( "num" , 1 ).obj() );
{
- BSONObj res = conn.findOne( ns , BSONObjBuilder().doneAndDecouple() );
+ BSONObj res = conn.findOne( ns , BSONObjBuilder().obj() );
assert( strstr( res.getStringField( "name" ) , "eliot" ) );
assert( ! strstr( res.getStringField( "name2" ) , "eliot" ) );
assert( 1 == res.getIntField( "num" ) );
@@ -48,9 +48,9 @@ int main() {
// cursor
- conn.insert( ns ,BSONObjBuilder().append( "name" , "sara" ).append( "num" , 2 ).doneAndDecouple() );
+ conn.insert( ns ,BSONObjBuilder().append( "name" , "sara" ).append( "num" , 2 ).obj() );
{
- auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().doneAndDecouple() );
+ auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().obj() );
int count = 0;
while ( cursor->more() ) {
count++;
@@ -60,7 +60,7 @@ int main() {
}
{
- auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().append( "num" , 1 ).doneAndDecouple() );
+ auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().append( "num" , 1 ).obj() );
int count = 0;
while ( cursor->more() ) {
count++;
@@ -70,7 +70,7 @@ int main() {
}
{
- auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().append( "num" , 3 ).doneAndDecouple() );
+ auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObjBuilder().append( "num" , 3 ).obj() );
int count = 0;
while ( cursor->more() ) {
count++;
@@ -81,25 +81,25 @@ int main() {
// update
{
- BSONObj res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).doneAndDecouple() );
+ BSONObj res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() );
assert( ! strstr( res.getStringField( "name2" ) , "eliot" ) );
- BSONObj after = BSONObjBuilder().appendElements( res ).append( "name2" , "h" ).doneAndDecouple();
+ BSONObj after = BSONObjBuilder().appendElements( res ).append( "name2" , "h" ).obj();
- conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).doneAndDecouple() , after );
- res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).doneAndDecouple() );
+ conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() , after );
+ res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() );
assert( ! strstr( res.getStringField( "name2" ) , "eliot" ) );
- assert( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).doneAndDecouple() ).isEmpty() );
+ assert( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() ).isEmpty() );
- conn.update( ns , BSONObjBuilder().append( "name" , "eliot" ).doneAndDecouple() , after );
- res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).doneAndDecouple() );
+ conn.update( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() , after );
+ res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() );
assert( strstr( res.getStringField( "name" ) , "eliot" ) );
assert( strstr( res.getStringField( "name2" ) , "h" ) );
- assert( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).doneAndDecouple() ).isEmpty() );
+ assert( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() ).isEmpty() );
// upsert
- conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).doneAndDecouple() , after , 1 );
- assert( ! conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).doneAndDecouple() ).isEmpty() );
+ conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() , after , 1 );
+ assert( ! conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() ).isEmpty() );
}
diff --git a/client/examples/first.cpp b/client/examples/first.cpp
index 570eb1992f4..0fdb1fa8151 100644
--- a/client/examples/first.cpp
+++ b/client/examples/first.cpp
@@ -12,7 +12,7 @@ void insert( mongo::DBClientConnection & conn , const char * name , int num ) {
mongo::BSONObjBuilder obj;
obj.append( "name" , name );
obj.append( "num" , num );
- conn.insert( "test.people" , obj.doneAndDecouple() );
+ conn.insert( "test.people" , obj.obj() );
}
int main() {
@@ -26,7 +26,7 @@ int main() {
{ // clean up old data from any previous tests
mongo::BSONObjBuilder query;
- conn.remove( "test.people" , query.doneAndDecouple() );
+ conn.remove( "test.people" , query.obj() );
}
insert( conn , "eliot" , 15 );
@@ -34,7 +34,7 @@ int main() {
{
mongo::BSONObjBuilder query;
- auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.doneAndDecouple() );
+ auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.obj() );
cout << "using cursor" << endl;
while ( cursor->more() ) {
mongo::BSONObj obj = cursor->next();
@@ -46,14 +46,14 @@ int main() {
{
mongo::BSONObjBuilder query;
query.append( "name" , "eliot" );
- mongo::BSONObj res = conn.findOne( "test.people" , query.doneAndDecouple() );
+ mongo::BSONObj res = conn.findOne( "test.people" , query.obj() );
cout << res.isEmpty() << "\t" << res.jsonString() << endl;
}
{
mongo::BSONObjBuilder query;
query.append( "name" , "asd" );
- mongo::BSONObj res = conn.findOne( "test.people" , query.doneAndDecouple() );
+ mongo::BSONObj res = conn.findOne( "test.people" , query.obj() );
cout << res.isEmpty() << "\t" << res.jsonString() << endl;
}
diff --git a/client/gridfs.cpp b/client/gridfs.cpp
index 93c907b9a43..987f6c49b51 100644
--- a/client/gridfs.cpp
+++ b/client/gridfs.cpp
@@ -21,7 +21,7 @@ namespace mongo {
b.appendAs( fileId , "files_id" );
b.appendInt( "n" , chunkNumber );
b.appendBinDataArray( "data" , data , len );
- _data = b.doneAndDecouple();
+ _data = b.obj();
}
@@ -54,7 +54,7 @@ namespace mongo {
id.init();
b.appendOID( "_id" , &id );
- fileObject = b.doneAndDecouple();
+ fileObject = b.obj();
}
char buf[DEFAULT_CHUNK_SIZE];
@@ -104,7 +104,7 @@ namespace mongo {
b.appendAs( _obj["_id"] , "files_id" );
b.appendInt( "n" , n );
- BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.doneAndDecouple() );
+ BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.obj() );
assert( ! o.isEmpty() );
return Chunk(o);
}
diff --git a/client/model.cpp b/client/model.cpp
index d740b44f574..7f47e187ad4 100644
--- a/client/model.cpp
+++ b/client/model.cpp
@@ -47,7 +47,7 @@ namespace mongo {
OID oid;
b.appendOID( "_id" , &oid );
- BSONObj o = b.doneAndDecouple();
+ BSONObj o = b.obj();
conn.insert( getNS() , o );
_id = o["_id"];
@@ -57,7 +57,7 @@ namespace mongo {
b.append( _id );
BSONObjBuilder id;
id.append( _id );
- conn.update( getNS() , id.doneAndDecouple() , b.doneAndDecouple() );
+ conn.update( getNS() , id.obj() , b.obj() );
log(4) << "updated old model" << endl;
}