Ability to group several Mongoid atomic operation calls into one server operation

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Persistence
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      (Not at all urgent, just filing for future ideas. Please put in backlog.)

       

      Currently, the atomic operation API allows only one atomic action at a time:

      person = Person.all.first
      
      # the following lines perform 3 database actions
      person.set(name: "Bob")
      person.unset(:first_name)
      person.inc(likes: 1)
      

       

      It would be nice if we had a way to lazy evaluate the actions so the run as one command: 

      person = Person.all.first
      
      person.atomic.set(name: "Bob").unset(:first_name).inc(likes: 1).perform
      

      In the above #atomic is analogous to Enumerable.lazy method.

      (Often I find that I do pull and push, set and unset, etc. together in the same places in my code, so this could have some performance advantage.)

              Assignee:
              Unassigned
              Reporter:
              Johnny Shields
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: