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

Editing/Deleting embedded documents without database queries

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      I would like to take a persisted document, and delete/rebuild some of the embedded documents inside it.

      So far when I call self.comments.clear or self.comments = [] to get started, it actually does a database query right away on this. And if my process dies or gets killed in the next moment, those embedded docs are lost.

      What I'd like to have happen is that I delete/rebuild all the embedded docs in memory, then call one save at the end (atomically) on the parent where all the updated children get persisted together.

      Is this possible?

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            barmstrong Brian Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: