Mongoid 7->9 regression: Adding an embedded document calls #touch on the parent document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 9.0.6
    • Component/s: Performance
    • None
    • Ruby Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      It appears that adding an embedded document to a parent document now does two separate DB actions:

      1. Atomically insert the embedded document into the parent document (see Creatable#insert_as_embedded)
      2. Call #touch on the parent document in a separate callback.

      This is not good, it means adding embedded documents now takes twice the DB roundtrip latency. The touch on the parent could be done in the same DB call as the insert.

      In Mongoid 7, the touch action does not happen.

      I need to investigate more exactly how this is happening, but it should be considered a serious performance regression. Filing it here for further investigation.

            Assignee:
            Jamis Buck
            Reporter:
            Johnny Shields
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: