Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-76826

$merge doesn't work with document that has dollar fields

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc1, 6.0.7, 5.0.19
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • v7.0, v6.3, v6.0, v5.0, v4.4
    • 135

      Currently, if the client document for merge has the first field starting with '$', it may be treated as a modifier style update, even when the intention is always a replacement style update. This triggered the invariant in the linked BF.

      However, even if we fix the invariant, supporting $merge with dollar fields across the board is harder than expected. For example, if the merge strategy results in a modifier style update, having a dollar field in the updated document will trigger validation assertion down the line. Even if it's a replacement style update, it still may trigger validation assertion after experiments.

      To be relatively consistent instead of only supporting dollar fields in some combination of merge strategies, we can also consider rejecting the dollar fields except for the pipeline style update.

            rui.liu@mongodb.com Rui Liu
            rui.liu@mongodb.com Rui Liu
            0 Vote for this issue
            3 Start watching this issue