diff options
author | Aaron <aaron@10gen.com> | 2012-03-06 20:59:44 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-03-06 20:59:44 -0800 |
commit | b17579687420f13afcb173f29556d89475d3f31b (patch) | |
tree | ce80b31df48cae8aa30c1bbbdbc320f24a44e000 /src/mongo/db/ops/update.h | |
parent | dfee494de5b07c05668d1a2bcbade34731110a1a (diff) | |
download | mongo-b17579687420f13afcb173f29556d89475d3f31b.tar.gz |
SERVER-4776 only use numeric comparison in updates when applying modifiers to an array
Diffstat (limited to 'src/mongo/db/ops/update.h')
-rw-r--r-- | src/mongo/db/ops/update.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/ops/update.h b/src/mongo/db/ops/update.h index 5f0be6a43a6..77bedba97dd 100644 --- a/src/mongo/db/ops/update.h +++ b/src/mongo/db/ops/update.h @@ -419,7 +419,8 @@ namespace mongo { ModHolder::const_iterator start = _mods.lower_bound(fieldName.substr(0,idx)); for ( ; start != _mods.end(); start++ ) { - FieldCompareResult r = compareDottedFieldNames( fieldName , start->first ); + FieldCompareResult r = compareDottedFieldNames( fieldName , start->first , + LexNumCmp( true ) ); switch ( r ) { case LEFT_SUBFIELD: return true; case LEFT_BEFORE: return false; @@ -535,7 +536,7 @@ namespace mongo { BSONObj _newFromMods; // keep this data alive, as oplog generation may depend on it ModSetState( const BSONObj& obj ) - : _obj( obj ) , _inPlacePossible(true) { + : _obj( obj ) , _mods( LexNumCmp( true ) ) , _inPlacePossible(true) { } /** @@ -547,8 +548,15 @@ namespace mongo { return _inPlacePossible; } + ModStateRange modsForRoot( const string &root ); + + void createNewObjFromMods( const string &root, BSONObjBuilder &b, const BSONObj &obj ); + void createNewArrayFromMods( const string &root, BSONArrayBuilder &b, + const BSONArray &arr ); + template< class Builder > - void createNewFromMods( const string& root , Builder& b , const BSONObj &obj ); + void createNewFromMods( const string& root , Builder& b , BSONIteratorSorted& es , + const ModStateRange& modRange , const LexNumCmp& lexNumCmp ); template< class Builder > void _appendNewFromMods( const string& root , ModState& m , Builder& b , set<string>& onedownseen ); |