[SERVER-5762] conversions to dates don't accept constant arguments Created: 03/May/12  Updated: 15/Aug/12  Resolved: 03/Jul/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 2.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Matt Dannenberg
Resolution: Duplicate Votes: 3
Labels: 212push
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-6150 $isoDate cannot be created with field... Closed
Operating System: ALL
Participants:

 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.



 Comments   
Comment by Chris Westin [ 07/May/12 ]

@M Schaffer: The dollar signs in the wiki were a typo. These are named parameters to $isoDate, not operators themselves. I've fixed the wiki by removing the dollar signs so that it looks like the example above.

Comment by M Schaffer [ 04/May/12 ]

Will the year,month, dayOfMonth keywords have a $ placed in front of them as in the documentation or will it stay without it as in your example above?

Documentation:
$isoDate:{$year: <year>, $month: <month>, $dayOfMonth: <dayOfMonth>,
$hour: <hour>, $minute: <minute>, $second: <second>}

Generated at Thu Feb 08 03:09:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.