should matcher prevent use of $ prefixed field names?

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Right now if someone attempts to use an aggregation expression inside a query or inside a $match, they will see results different from what they expect (and no error):

      t = db.t;
      t.drop();
      
      t.save( { a:1, b:5 } );
      printjson( t.find( { a:1, b:{ $gt:{ $add:[ 1, 1 ] } } } ).toArray() );
      printjson( t.aggregate( { $match:{ a:1, b:{ $gt:{ $add:[ 1, 1 ] } } } } ) );
      

      In both cases

      { $add:[ 1, 1 ] }

      is treated as a document to compare against, not an expression to be evaluated.

              Assignee:
              Unassigned
              Reporter:
              Aaron Staple (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: