diff options
author | Dwight <dmerriman@gmail.com> | 2009-02-09 13:04:32 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-02-09 13:04:32 -0500 |
commit | 147948c7b33d4542a99352dd02ec3cb88f401a7c (patch) | |
tree | f7f2daa54521467911f742c42cfd073eb528f80c /db | |
parent | 10d5a55c357c9190b85576fc77bee8a71bb4d05e (diff) | |
download | mongo-147948c7b33d4542a99352dd02ec3cb88f401a7c.tar.gz |
doneAndDecouple() -> obj()
Diffstat (limited to 'db')
-rw-r--r-- | db/btreecursor.cpp | 4 | ||||
-rw-r--r-- | db/cloner.cpp | 2 | ||||
-rw-r--r-- | db/curop.h | 4 | ||||
-rw-r--r-- | db/db.sln | 23 | ||||
-rw-r--r-- | db/dbcommands.cpp | 2 | ||||
-rw-r--r-- | db/dbwebserver.cpp | 2 | ||||
-rw-r--r-- | db/jsobj.cpp | 8 | ||||
-rw-r--r-- | db/jsobj.h | 10 | ||||
-rw-r--r-- | db/json.cpp | 2 | ||||
-rw-r--r-- | db/pdfile.cpp | 4 | ||||
-rw-r--r-- | db/query.cpp | 6 | ||||
-rw-r--r-- | db/repl.cpp | 2 |
12 files changed, 46 insertions, 23 deletions
diff --git a/db/btreecursor.cpp b/db/btreecursor.cpp index dc1d5ad685d..62b73aa30cf 100644 --- a/db/btreecursor.cpp +++ b/db/btreecursor.cpp @@ -100,8 +100,8 @@ namespace mongo { startBuilder.appendAs( forward ? lowest : highest, "" ); endBuilder.appendAs( forward ? highest : lowest, "" ); } - startKey = startBuilder.doneAndDecouple(); - endKey = endBuilder.doneAndDecouple(); + startKey = startBuilder.obj(); + endKey = endBuilder.obj(); } // Find lowest and highest possible key values given all $gt, $gte, $lt, and diff --git a/db/cloner.cpp b/db/cloner.cpp index c7daf5c8037..324fb1a84a7 100644 --- a/db/cloner.cpp +++ b/db/cloner.cpp @@ -69,7 +69,7 @@ namespace mongo { else b.append(e); } - BSONObj res= b.doneAndDecouple(); + BSONObj res= b.obj(); /* if( mod ) { out() << "before: " << o.toString() << endl; diff --git a/db/curop.h b/db/curop.h index 3b878a046c4..e3b35619155 100644 --- a/db/curop.h +++ b/db/curop.h @@ -36,7 +36,7 @@ namespace mongo { AuthenticationInfo *ai = authInfo.get(); if( ai == 0 || !ai->isAuthorized("admin") ) { b.append("err", "unauthorized"); - return b.doneAndDecouple(); + return b.obj(); } b.append("opid", opNum);
@@ -58,7 +58,7 @@ namespace mongo { b.append("ns", ns);
b.append("query", query);
b.append("inLock", dbMutexInfo.isLocked());
- return b.doneAndDecouple();
+ return b.obj();
}
} currentOp;
diff --git a/db/db.sln b/db/db.sln index 4eba708344e..c2e08932b3d 100644 --- a/db/db.sln +++ b/db/db.sln @@ -20,15 +20,38 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dbtests", "dbtests", "{C72EBEDD-342D-4371-8B0D-D7505902FA69}"
ProjectSection(SolutionItems) = preProject
..\dbtests\btreetests.cpp = ..\dbtests\btreetests.cpp
+ ..\dbtests\dbtests.cpp = ..\dbtests\dbtests.cpp
+ ..\dbtests\javajstests.cpp = ..\dbtests\javajstests.cpp
+ ..\dbtests\jsobjtests.cpp = ..\dbtests\jsobjtests.cpp
+ ..\dbtests\jsontests.cpp = ..\dbtests\jsontests.cpp
..\dbtests\matchertests.cpp = ..\dbtests\matchertests.cpp
..\dbtests\namespacetests.cpp = ..\dbtests\namespacetests.cpp
..\dbtests\pairingtests.cpp = ..\dbtests\pairingtests.cpp
+ ..\dbtests\pdfiletests.cpp = ..\dbtests\pdfiletests.cpp
..\dbtests\querytests.cpp = ..\dbtests\querytests.cpp
+ ..\dbtests\repltests.cpp = ..\dbtests\repltests.cpp
..\dbtests\socktests.cpp = ..\dbtests\socktests.cpp
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tutorial", "..\client\examples\tutorial\tutorial.vcproj", "{C5EC52B2-1E28-4AF1-A244-CBB514C361C0}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shell", "shell", "{2CABB3B8-C9A6-478D-9463-0B37799ED708}"
+ ProjectSection(SolutionItems) = preProject
+ ..\shell\dbshell.cpp = ..\shell\dbshell.cpp
+ ..\shell\MongoJS.cpp = ..\shell\MongoJS.cpp
+ ..\shell\ShellUtils.cpp = ..\shell\ShellUtils.cpp
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{2B262D59-9DC7-4BF1-A431-1BD4966899A5}"
+ ProjectSection(SolutionItems) = preProject
+ ..\tools\dump.cpp = ..\tools\dump.cpp
+ ..\tools\export.cpp = ..\tools\export.cpp
+ ..\tools\files.cpp = ..\tools\files.cpp
+ ..\tools\importJSON.cpp = ..\tools\importJSON.cpp
+ ..\tools\restore.cpp = ..\tools\restore.cpp
+ ..\tools\Tool.cpp = ..\tools\Tool.cpp
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Recstore|Win32 = Debug Recstore|Win32
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 35796209e72..ba4437bd75c 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -677,7 +677,7 @@ namespace mongo { BSONObjBuilder b; b.append( "name", i->c_str() ); b.append( "sizeOnDisk", (double) dbSize( i->c_str() ) ); - dbInfos.push_back( b.doneAndDecouple() ); + dbInfos.push_back( b.obj() ); seen.insert( i->c_str() ); } diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp index 8407fd18f9f..29a97b65058 100644 --- a/db/dbwebserver.cpp +++ b/db/dbwebserver.cpp @@ -366,7 +366,7 @@ namespace mongo { queryBuilder.append( field , val ); } - BSONObj query = queryBuilder.doneAndDecouple(); + BSONObj query = queryBuilder.obj(); auto_ptr<DBClientCursor> cursor = db.query( ns.c_str() , query, num , skip ); diff --git a/db/jsobj.cpp b/db/jsobj.cpp index 93de84be27f..1b309838db3 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -751,7 +751,7 @@ namespace mongo { return BSONObj(); b.appendAs(x, ""); } - return b.doneAndDecouple(); + return b.obj(); } BSONObj BSONObj::extractFields(BSONObj& pattern) { @@ -766,7 +766,7 @@ namespace mongo { return BSONObj(); b.append(x); } - return b.doneAndDecouple(); + return b.obj(); } int BSONObj::getIntField(const char *name) const { @@ -877,7 +877,7 @@ namespace mongo { b.append( e ); } } - return b.doneAndDecouple(); + return b.obj(); } BSONObj BSONObj::replaceFieldNames( const vector< string > &names ) const { @@ -895,7 +895,7 @@ namespace mongo { b.append( e ); } } - return b.doneAndDecouple(); + return b.obj(); } string BSONObj::hexDump() const { diff --git a/db/jsobj.h b/db/jsobj.h index a3d7fac9a2f..2e363bb7a06 100644 --- a/db/jsobj.h +++ b/db/jsobj.h @@ -728,7 +728,7 @@ namespace mongo { e.g., BSON( "name" << "joe" << "age" << 33 ) */ -#define BSON(x) (( BSONObjBuilder() << x ).doneAndDecouple()) +#define BSON(x) (( BSONObjBuilder() << x ).obj()) class BSONObjBuilderValueStream { public: @@ -946,15 +946,15 @@ namespace mongo { marshalArray( fieldName, arrBuilder.done() ); } - /** BSONObj will free the buffer when it is finished. */ - BSONObj doneAndDecouple() { + /** The returned BSONObj will free the buffer when it is finished. */ + BSONObj obj() { int l; return BSONObj(decouple(l), true); } /** Fetch the object we have built. BSONObjBuilder still frees the object when the builder goes out of - scope -- very important to keep in mind. Use doneAndDecouple() if you + scope -- very important to keep in mind. Use obj() if you would like the BSONObj to last longer than the builder. */ BSONObj done() { @@ -1125,7 +1125,7 @@ namespace mongo { inline BSONObj BSONElement::wrap() { BSONObjBuilder b; b.append(*this); - return b.doneAndDecouple(); + return b.obj(); } inline bool BSONObj::hasElement(const char *name) const { diff --git a/db/json.cpp b/db/json.cpp index 5cd72d9d0fa..595ab76599d 100644 --- a/db/json.cpp +++ b/db/json.cpp @@ -39,7 +39,7 @@ namespace mongo { indexes.push_back( 0 ); } BSONObj pop() { - BSONObj ret = back()->doneAndDecouple(); + BSONObj ret = back()->obj(); builders.pop_back(); fieldNames.pop_back(); indexes.pop_back(); diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 3fa39696dc5..3d152299077 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -507,7 +507,7 @@ namespace mongo { break; b.append( f ); } - BSONObj o = b.doneAndDecouple(); + BSONObj o = b.obj(); assert( !o.isEmpty() ); keys.insert(o); return; @@ -536,7 +536,7 @@ namespace mongo { b.appendAs( e, "" ); } - BSONObj o = b.doneAndDecouple(); + BSONObj o = b.obj(); assert( !o.isEmpty() ); keys.insert(o); } diff --git a/db/query.cpp b/db/query.cpp index c3c01795253..20507ccd2a4 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -243,7 +243,7 @@ namespace mongo { if( js.getObjectID( e ) ) { BSONObjBuilder b; b.append( e ); - *deletedId = b.doneAndDecouple(); + *deletedId = b.obj(); } } break; @@ -385,7 +385,7 @@ namespace mongo { // if there's no id. if ( js.getObjectID( id ) ) { idPattern.append( id ); - pattern = idPattern.doneAndDecouple(); + pattern = idPattern.obj(); } } @@ -619,7 +619,7 @@ namespace mongo { uassert("too many ordering elements", *p <= '9'); } - return b.doneAndDecouple(); + return b.obj(); } QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoreturn, BSONObj jsobj, diff --git a/db/repl.cpp b/db/repl.cpp index 504716d2379..5fe55c3fa75 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -450,7 +450,7 @@ namespace mongo { if ( n ) b.append("dbs", dbs_builder.done()); - return b.doneAndDecouple(); + return b.obj(); } void ReplSource::save() { |