|
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.
|