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

should matcher prevent use of $ prefixed field names?

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: