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

$isoDate cannot be created with field values other than 0 and 1

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • ALL

      Seems to be related to a parsing issue.

      c = db.c;
      c.drop();
      
      c.save( {} );
      // Seems to work, using syntax similar to that in testall.js.                                   
      printjson( c.aggregate( { $project : { date: { $isoDate:[{ year:1 }] } } } ) );
      // Seems to not work because the year value is not 1 or 0.                              
      printjson( c.aggregate( { $project : { date: { $isoDate:[{ year:2 }] } } } ) );
      // Seems to not work using syntax from documentation page.                                   
      printjson( c.aggregate( { $project : { date: { $isoDate:{ '$year':2 } } } } ) );
      printjson( c.aggregate( { $project : { date: { $isoDate:[{ '$year':2 }] } } } ) );
      

      Observed behavior: assertions when trying to create a date with { $isoDate:[

      { year:1 }

      ] }.
      Expected behavior: a valid date is created.

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: