diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-01-16 10:25:32 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-01-16 10:25:32 -0500 |
commit | d61342572459e7942871b427e373a686a04b55f7 (patch) | |
tree | a3c350a7b5e70d5e30460cee8f81a1b886b6b88f | |
parent | ae7110f3bc28e8c279f7e1615b4591a3cb073856 (diff) | |
download | mongo-d61342572459e7942871b427e373a686a04b55f7.tar.gz |
fix upset with x.y query and $mod SERVER-390
-rw-r--r-- | db/update.cpp | 9 | ||||
-rw-r--r-- | jstests/updateb.js | 11 |
2 files changed, 15 insertions, 5 deletions
diff --git a/db/update.cpp b/db/update.cpp index 19b0b263caf..bba3b54d1e8 100644 --- a/db/update.cpp +++ b/db/update.cpp @@ -434,7 +434,8 @@ namespace mongo { { BSONObjBuilder bb; - BSONObjIterator i( query ); + EmbeddedBuilder eb( &bb ); + BSONObjIteratorSorted i( query ); while ( i.more() ){ BSONElement e = i.next(); @@ -443,11 +444,9 @@ namespace mongo { continue; } - uassert( 10146 , "upsert with foo.bar type queries not supported yet" , strchr( e.fieldName() , '.' ) == 0 ); - - - bb.append( e ); + eb.appendAs( e , e.fieldName() ); } + eb.done(); newObj = bb.obj(); } diff --git a/jstests/updateb.js b/jstests/updateb.js new file mode 100644 index 00000000000..ee7c531052f --- /dev/null +++ b/jstests/updateb.js @@ -0,0 +1,11 @@ + +t = db.updateb; +t.drop(); + +t.update( { "x.y" : 2 } , { $inc : { a : 7 } } , true ); + +correct = { a : 7 , x : { y : 2 } }; +got = t.findOne(); +delete got._id; +assert.eq( correct , got , "A" ) + |