diff --git a/db/instance.cpp b/db/instance.cpp index e4ff204c0a0..e085532dc78 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -333,7 +333,6 @@ namespace mongo { receivedDelete(m, currentOp); } else if ( op == dbKillCursors ) { - mongolock lk(writeLock); currentOp.ensureStarted(); logThreshold = 10; ss << "killcursors "; diff --git a/db/jsobj.cpp b/db/jsobj.cpp index 27403516337..2b3359ceb6b 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -1140,7 +1140,10 @@ namespace mongo { if ( strchr( name , '.' ) || strchr( name , '$' ) ){ - return false; + return + strcmp( name , "$ref" ) == 0 || + strcmp( name , "$id" ) == 0 + ; } if ( e.mayEncapsulate() ){ diff --git a/db/update.cpp b/db/update.cpp index c75731317c1..d5f05d64e27 100644 --- a/db/update.cpp +++ b/db/update.cpp @@ -633,6 +633,9 @@ namespace mongo { int profile = cc().database()->profile; StringBuilder& ss = debug.str; + if ( logLevel > 2 ) + ss << " update: " << updateobj; + /* idea with these here it to make them loop invariant for multi updates, and thus be a bit faster for that case */ /* NOTE: when yield() is added herein, these must be refreshed after each call to yield! */ NamespaceDetails *d = nsdetails(ns); // can be null if an upsert... diff --git a/jstests/set6.js b/jstests/set6.js new file mode 100644 index 00000000000..d41e7aba971 --- /dev/null +++ b/jstests/set6.js @@ -0,0 +1,20 @@ + +t = db.set6; +t.drop(); + +x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) } +t.insert( x ) +assert.eq( x , t.findOne() , "A" ); + +x.r.$id = new ObjectId() +t.update({}, { $set : { r : x.r } } ); +assert.eq( x , t.findOne() , "B"); + +x.r2 = new DBRef( "foo2" , 5 ) +t.update( {} , { $set : { "r2" : x.r2 } } ); +assert.eq( x , t.findOne() , "C" ) + +x.r.$id = 2; +t.update( {} , { $set : { "r.$id" : 2 } } ) +assert.eq( x.r.$id , t.findOne().r.$id , "D"); +