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

Regression: Root document's updated_at not updated if only embedded documents change

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:

      Description

      Under 2.0.0.rc.8, when you update a root document that only has changes on embedded documents (embeds_one or embeds_many) then the root document's updated_at value isn't updated. Under 2.0.0.beta.20, the updated_at column was updated for changes on embedded documents.

      This caused a bug in our application where we fed content updates via a changes API driven by a 'changed since' timestamp that looked at the root document's updated_at. The embedded documents don't carry an updated_at field. Since the updated_at field wasn't getting updated, content changes were not being picked up by clients.

      Exactly how this should behave is debatable, depending on how strong the relation is between the models within the application's domain, but given that the updated_at field is driven by callbacks, and callbacks aren't fired for embedded documents, and that this is a change between the beta and RC versions, I think it's best to have the root document's updated_at field updated when embedded documents change.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            cgriego Chris Griego
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: