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

'can't add two dates together' assertion during constant folding

    • Type: Icon: Improvement Improvement
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None

      In general we seem to support concatenation of multiple dates with strings but not addition of multiple dates.

      Observed behavior: uassert if an attempt is made to add two dates as part of constant folding, even if the folded value would be unused because of a non constant string value.
      Expected behavior: No uassert in this case.

      Test:

      c = db.c;
      c.drop();
      
      c.save( { x:' ' } );
      
      // No uassert when concatenating multiple constants.
      printjson( c.aggregate( { $project:{ a:{ $add:[ new Date(), ' ', new Date() ] } } } ) );
      // uassert when concatenating date constants (constant folding) and a non constant string.
      printjson( c.aggregate( { $project:{ a:{ $add:[ new Date(), '$x', new Date() ] } } } ) );
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: