mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
fix un-sorted update
This commit is contained in:
parent
a71ff07701
commit
e9257ac751
@ -317,7 +317,7 @@ namespace mongo {
|
||||
}
|
||||
|
||||
void ModSet::createNewFromMods( const string& root , BSONObjBuilder& b , const BSONObj &obj ){
|
||||
BSONObjIterator es( obj );
|
||||
BSONObjIteratorSorted es( obj );
|
||||
BSONElement e = es.next();
|
||||
|
||||
ModHolder::iterator m = _mods.lower_bound( root );
|
||||
|
19
jstests/update9.js
Normal file
19
jstests/update9.js
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
t = db.update9;
|
||||
t.drop()
|
||||
|
||||
orig = { "_id" : 1 ,
|
||||
"question" : "a",
|
||||
"choices" : { "1" : { "choice" : "b" },
|
||||
"0" : { "choice" : "c" } } ,
|
||||
|
||||
}
|
||||
|
||||
t.save( orig );
|
||||
assert.eq( orig , t.findOne() , "A" );
|
||||
|
||||
t.update({_id: 1, 'choices.0.votes': {$ne: 1}}, {$push: {'choices.0.votes': 1}})
|
||||
|
||||
orig.choices["0"].votes = [ 1 ] ;
|
||||
assert.eq( orig.choices["0"] , t.findOne().choices["0"] , "B" );
|
||||
|
Loading…
Reference in New Issue
Block a user