-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 6.0.0, 5.0.16, 6.3.0-rc3
-
Component/s: Write Ops
-
Query Optimization
-
Minor Change
-
ALL
-
v7.0, v6.3, v6.0, v5.0
-
QO 2023-05-29, QO 2023-06-12
This is a continuation to SERVER-75517 where the changes from 819f9d1 made it so the server checks the top-level fields within an _id embedded object do not start with a '$' character. The non top-level fields in the _id embedded object won't be validated for '$' characters by an update using upsert=true. The upsert behavior diverges from the storage_validation::storageValidIdField() / BSONObj::storageValidEmbedded() behavior called by the insert command via fixDocumentForInsert() in which the latter recursive checks that fields in embedded objects and arrays at any level do not start with a '$' character.
This difference in behavior between [updates using upsert=true] and inserts would prevent tools like mongosync which perform a logical sync from successfully copying over the documents. Probably the documents should be prevented from being upserted to preserve the pre PM-1856 behavior for the _id field.
- is related to
-
SERVER-75517 illegal format of `_id` possible via upsert
- Closed
- related to
-
SERVER-77858 Collection validation and dbCheck should error if document has an invalid _id
- Open
-
SERVER-77590 Consolidate the validation paths for _id fields between inserts and updates
- Backlog