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

conversions to dates don't accept constant arguments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: