[SERVER-75879] Upsert permits document to contain multiple _id fields Created: 08/Apr/23  Updated: 29/Oct/23  Resolved: 19/May/23

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 4.0.0, 4.2.0, 4.4.0, 5.0.0, 6.0.0, 6.3.0-rc3
Fix Version/s: 7.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Chi-I Huang
Resolution: Fixed Votes: 0
Labels: query-director-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-77858 Collection validation and dbCheck sho... Open
related to SERVER-78093 Investigate and add test cases to val... Backlog
is related to SERVER-4830 Reject upsert if would create duplica... Closed
is related to SERVER-19361 Insert of document with duplicate _id... Closed
Assigned Teams:
Query Optimization
Backwards Compatibility: Minor Change
Operating System: ALL
Backport Requested:
v7.0, v6.3, v6.0, v5.0, v4.4, v4.2
Sprint: QO 2023-05-15, QO 2023-05-29
Participants:

 Description   

The update subsystem lacks the equivalent of all of these lines from fixDocumentForInsert() to check the document doesn't have multiple _id fields when inserted by an update sent with upsert=true.



 Comments   
Comment by Githook User [ 19/May/23 ]

Author:

{'name': 'Chi-I Huang', 'email': 'chiihuang@mongodb.com', 'username': ''}

Message: SERVER-75879 Add validation to prevent duplicate _id fields from update
Branch: master
https://github.com/mongodb/mongo/commit/6aa7c4bb7fdd3b8a6beb4088637848f1b454ca5a

Comment by Chi-I Huang [ 17/May/23 ]

Update: The PR has been approved. I try to add integration tests into the same PR if possible. If nontrivial, I will create another ticket for integration tests.

For integration tests, there are 2 potential approaches to introduce invalid BSON in jstest. One is to reuse _writeTestPipe and _readTestPipe in jstests/noPassthrough/external_data_source.js. Another one is introduce a generic BSON function in src/mongo/shell/shell_utils.cpp

Generated at Thu Feb 08 06:31:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.