[SERVER-82051] $out to time-series doesn't add _id if it's missing Created: 10/Oct/23  Updated: 27/Oct/23  Resolved: 13/Oct/23

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

Type: Bug Priority: Major - P3
Reporter: Felipe Gasper Assignee: Backlog - Storage Execution Team
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Operating System: ALL
Participants:

 Description   

Seen on 7.0.2-66-g6c4e1e8

db.aggregate( [{ $documents: [ { mytimefield: new Date() } ] }, { $out: { db: "mydb", coll: "mycoll", timeseries: { timeField: "mytimefield" } } }, ]);
db.getSiblingDB("mydb").mycoll.find()

^^ The above prints a single document with just the `mytimefield` field, no `_id`.

UPDATE: Apparently the _id on inserts comes from the driver.



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

This is inconsistent with `insert`, which adds `_id` if it's not set on the inserted document.

At least purely from the server perspective I think this isn't the case, unless it's changed since I worked on this. My understanding was that most drivers will add an _id if it's not provided by the user. But if the driver doesn't add it, for time-series inserts we leave it as-is (as opposed to non-time-series inserts where the server will add an _id).

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