summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-01-16 10:25:32 -0500
committerEliot Horowitz <eliot@10gen.com>2010-01-16 10:25:32 -0500
commitd61342572459e7942871b427e373a686a04b55f7 (patch)
treea3c350a7b5e70d5e30460cee8f81a1b886b6b88f
parentae7110f3bc28e8c279f7e1615b4591a3cb073856 (diff)
downloadmongo-d61342572459e7942871b427e373a686a04b55f7.tar.gz
fix upset with x.y query and $mod SERVER-390
-rw-r--r--db/update.cpp9
-rw-r--r--jstests/updateb.js11
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" )
+