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

conversions to dates don't accept constant arguments

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.1.1
    • Component/s: Aggregation Framework
    • ALL

      Tried this

      var x = db.runCommand({aggregate: "foo", pipeline: [
        {$project: {
      //     doesn't work
      //      date: {$isoDate: {year: 2012, month: 2, dayOfMonth: 4} } ,
      /* // this worked - copy-pasted from testall.js
            testDate: {$isoDate:{
                year: "$year", month: "$month", dayOfMonth: "$dayOfMonth",
                hour: "$hour", minute: "$minutes", second: "$seconds"}}
      */
      // this didn't
            testDate: {$isoDate:{
                year: 2012, month: "$month", dayOfMonth: "$dayOfMonth",
                hour: "$hour", minute: "$minutes", second: "$seconds"}}
        }}
      ]});
      

      Get this error

      {
              "errmsg" : "exception: \"year\" numeric inclusion or exclusion must be 1
       or 0 (or boolean)",
              "code" : 15991,
              "ok" : 0
      }
      

      Looks like there's some kind of problem with the parser for this expression.

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: