Permalink
Browse files

SERVER-3360 don't allow embededd $ ops to propogate

  • Loading branch information...
1 parent 8c11a51 commit 28a46041cab843f559091837833f8af37ff315d4 @erh erh committed Jul 1, 2011
Showing with 7 additions and 0 deletions.
  1. +1 −0 db/ops/update.cpp
  2. +6 −0 jstests/update_invalid1.js
View
1 db/ops/update.cpp
@@ -1296,6 +1296,7 @@ namespace mongo {
if ( updateobj.firstElementFieldName()[0] == '$' ) {
/* upsert of an $inc. build a default */
BSONObj newObj = mods->createNewFromQuery( patternOrig );
+ checkNoMods( newObj );
debug.fastmodinsert = true;
theDataFileMgr.insertWithObjMod(ns, newObj, god);
if ( logop )
View
6 jstests/update_invalid1.js
@@ -0,0 +1,6 @@
+
+t = db.update_invalid1
+t.drop()
+
+t.update( { _id : 5 } , { $set : { $inc : { x : 5 } } } , true );
+assert.eq( 0 , t.count() , "A1" );

0 comments on commit 28a4604

Please sign in to comment.