-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
1) Making Inc really atomic
The Inc modifier currently uses write_attribute to update the attribute on the object locally apart from making the atomic update on the db. This defeats the purpose of atomic updates as a save on the model after this will re-persist the incremented attributes, possibly wiping another atomic modification. Details are here : http://groups.google.com/group/mongoid/browse_thread/thread/91c121183fdb2405
2) Updating multiple attributes in a single call to Inc
MongoDB supports atomic updates to multiple fields on documents with a single "$inc" operator.
Eg : db.foo.update({}, {"$inc" : { a : 1, b : -1}})
Having this feature in Mongoid will be pretty helpful. Currently the "inc" method takes a field name (key) and a value. Instead it can be made to take a hash of key-value pairs.