[SERVER-86370] $out with timeseries option gives confusing error message if timeField is not top level field Created: 07/Feb/24  Updated: 07/Feb/24

Status: Needs Scheduling
Project: Core Server
Component/s: None
Affects Version/s: 7.0.5
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Magnus Strale Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Integration
Participants:

 Description   

The following script running on MongoDB 7.0.5
 
 

const a = {$addFields: {   metaData: {     "imsOrgId": "$imsOrgId",     "sandboxName": "$sandboxName"   } }};
const p = {$project: { imsOrgId: 0, sandboxName: 0 }};
const o = {
   $out: {
     db: "audit",
     coll: "ts-events-enhanced",
     timeseries: {
       timeField: "coreEvent.timestamp",
       metaField: "metaData",
       granularity: "hours"
     }
   } }
db["unrolled-events"].aggregate([a, p, o])

 
Gves this error message:

PlanExecutor error during aggregation :: caused by :: time-series insert failed: audit-events.tmp.agg_out.247ead66-2923-4b54-b85e-d1b9653c9ca8 :: caused by :: 'coreEvent.timestamp' must be present and contain a valid BSON UTC datetime value

The error is very misleading, should give the same helpful error message ( 'timeField' must be a top-level field and not contain a '.'") as when doing a createCollection with the same TS definition.


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