Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-598

Make Inc support multiple Inc updates in a single call

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • 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.

            Assignee:
            durran Durran Jordan
            Reporter:
            sriranggd Srirang G Doddihal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: