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

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Execution

    Description

      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.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            sanika.phanse@mongodb.com Sanika Phanse (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: