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

should matcher prevent use of $ prefixed field names?

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      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 Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: