Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix upset with x.y query and $mod SERVER-390

  • Loading branch information...
commit d61342572459e7942871b427e373a686a04b55f7 1 parent ae7110f
@erh erh authored
Showing with 15 additions and 5 deletions.
  1. +4 −5 db/update.cpp
  2. +11 −0 jstests/updateb.js
View
9 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();
}
View
11 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" )
+
Please sign in to comment.
Something went wrong with that request. Please try again.