[SERVER-72523] Consider having mongod autogenerate _id fields for documents inserted into a time-series collection Created: 04/Jan/23  Updated: 10/Jan/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Backlog - Storage Execution Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Storage Execution
Participants:

 Description   

If a user inserts a document into MongoDB without an _id field, ordinarily either the client or mongod will automatically generate and add an _id field.

mongod does not do this for documents inserted to time series collections. This makes sense since the documents aren't stored directly in a collection, but rather in the buckets collection, which has its own autogenerated _id fields.

However, if a user expects that inserting a document like {a: 1, b: 1} will autogenerate an _id field and insert a document like {_id: ObjectId(...), a: 1, b: 1}, they may be surprised when this doesn't happen for time series collections.

We should discuss whether or not it's worth having mongod autogenerate _id fields for documents inserted into a time-series collection, and if so, we should maybe also file tickets for drivers which don't implement _id autogeneration.



 Comments   
Comment by Gregory Noma [ 10/Jan/23 ]

Potentially one concern here is that this could reinforce users relying on _id as a unique identifier even though there is no uniqueness enforcement on time-series collections.

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