Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86370

$out with timeseries option gives confusing error message if timeField is not top level field

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.5
    • Component/s: None
    • Query Integration
    • QI 2024-03-04, QI 2024-03-18, QI 2024-04-01, QI 2024-04-15, QI 2024-04-29, QI 2024-05-13, QI 2024-05-27, QI 2024-06-10, QI 2024-06-24, QI 2024-07-08, QI 2024-07-22, QI 2024-08-05, QI 2024-08-19, QI 2024-09-02, QI 2024-09-16, QI 2024-09-30, QI 2024-10-14

      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.

            Assignee:
            arun.banala@mongodb.com Arun Banala
            Reporter:
            magnus.strale@mongodb.com Magnus Strale
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: