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

Ensure consistent set of persisted documents

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

      Epic Summary

      Summary

      Currently Mongoid sometimes persists objects which reference other objects which fail validation, and thus are not persisted. The result is some documents in the database referencing nonexistent documents.

      ActiveRecord uses RDBMS transactions to abort persistence and roll back in some situations. Since MongoDB doesn't have nestable transactions this strategy is not viable for Mongoid. Instead Mongoid must perform a validation pass separately from persistence pass:

      1. Collect all objects which are to be persisted, by walking associations from the object on which save! etc. is called.
      2. Perform validations on all of these objects.
      3. If and only if the validations pass, persist all objects.

      Motivation

      Cast of Characters

      • Product Owner:
      • Project Lead:
      • Program Manager:
      • Drivers Contact:

      Documentation

      [Scope Document|]
      [Technical Design Document|]

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: