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

[Federated db] ISODate not working on a View with $project

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.0.14
    • Component/s: None
    • Labels:
    • ALL
    • Hide

      add a db from a atalas cluster to federated database.

      create a view on that db and in the pipeline you use any date command like ISODate or new Date.
       
      error: Data Lake storage config invalid (errors: [[database 'db1': view 'test_dates': pipeline failed to parse: invalid JSON input. Position: 38. Character: I]]).
       
      example pipeline:

       
      [{
      "$project":{
      "aborted_at":{
      "$cond":[

      { "$gt":[ "$aborted_at",ISODate("0001-01-01T00:00:00.000+0000") ] }

      ,

      { "$toDate":"$aborted_at" }

      ,
      null
      ]
      }
      }}]

      Show
      add a db from a atalas cluster to federated database. create a view on that db and in the pipeline you use any date command like ISODate or new Date.   error: Data Lake storage config invalid (errors: [ [database 'db1': view 'test_dates': pipeline failed to parse: invalid JSON input. Position: 38. Character: I] ]).   example pipeline:   [{ "$project":{ "aborted_at":{ "$cond":[ { "$gt":[ "$aborted_at",ISODate("0001-01-01T00:00:00.000+0000") ] } , { "$toDate":"$aborted_at" } , null ] } }}]

      Unable to use ISOdate or new date in $project of a view on a federated databse. 

       

      as a user i want to create a view in a federated database based on a collection of a atlas cluster. Inside this view I use the pipeline $project. Everything works fine unless you want to use dates like ISODate or new Date. Then you get following error.

       
      Data Lake storage config invalid (errors: [[database 'db1': view 'test_dates': pipeline failed to parse: invalid JSON input. Position: 38. Character: I]]).
       

            Assignee:
            yuan.fang@mongodb.com Yuan Fang
            Reporter:
            anthonyviaene@gmail.com Anthony Viaene
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: