[SERVER-6650] should matcher prevent use of $ prefixed field names? Created: 30/Jul/12  Updated: 11/Jul/16  Resolved: 16/Jun/13

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-4973 $not should return error if used as a... Closed
Participants:

 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.



 Comments   
Comment by Mathias Stearn [ 27/Aug/12 ]

Moving from Agg framework to Querying because this deals with the general Matcher class, not an agg specific version.

Comment by auto [ 24/Aug/12 ]

Author:

{u'date': u'2012-08-02T13:35:55-07:00', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-6650 label test cases.
Branch: master
https://github.com/mongodb/mongo/commit/258fb29b0d22dd49afb8a294ec0d26088b2ad186

Comment by Aaron Staple [ 30/Jul/12 ]

Scheduled in rc1 for triage.

Generated at Thu Feb 08 03:12:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.