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

Unify insert and {upsert: true} insert behavior for $setOnInsert: Timestamp(0,0)

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution

      Upon inserting a document with { $setOnInsert

      { 'a' : Timestamp(0,0) }

      , the timestamp is overwritten to reflect the operational timestamp here. However, an update with

      {upsert: true}

      that specifies $setOnInsert

      { 'a' : Timestamp(0,0) }

      preserves the value Timestamp(0,0) in the upserted document. This is inconsistent behavior between two types of inserts.

      I would recommend unifying this behavior.

      This ticket is relevant for the updateOneWithoutShardKey project as upserts are converted to inserts on mongos. So, while the user behavior would've originally expected Timestamp(0,0) to remain, it now reflects the operational timestamp.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            sanika.phanse@mongodb.com Sanika Phanse (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: