|
Splitting to two issues. If you want $reduce, watch or vote for http://jira.mongodb.org/browse/SERVER-394
Author:{'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}
Message: $unset support in update. http://github.com/mongodb/mongo/commit/cb16e7c62b094c81fd443b6f33f9b72b2f5a58f9 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Let's say we have { _id : 1, toberemoved : 'hello', dontremove :
'world' }
1) $db.foo.save( { _id : 1, dontremove : 'world' });
Could have concurrency issues.
2) $db.foo.update( { _id : 1, toberemoved : 'hello', dontremove :
'world' }, { _id : 1, dontremove : 'world' } );
Will fail if another process already changed the object.
3) $db.foo.update( { _id : 1 }, { $unset : { toberemoved : 1 } } );
This will never fail nor have any concurrency issues -ideal behavior-,