[SERVER-2549] expression native support , find({ a: { $lt : b*2 } }) Created: 14/Feb/11  Updated: 06/Dec/22  Resolved: 14/Aug/17

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

Type: New Feature Priority: Major - P3
Reporter: jason Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 7
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-2702 Compare document fields in queries Closed
Related
related to SERVER-4079 Computed Fields Closed
related to SERVER-2702 Compare document fields in queries Closed
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Participants:

 Comments   
Comment by jason [ 14/Feb/11 ]

> db.cc.find(

{custid:1102598027,$where:"this.a<this.b*2"}

).explain()
{
"cursor" : "BtreeCursor custid_1",
"nscanned" : 189958,
"nscannedObjects" : 189958,
"n" : 0,
"millis" : 3841,
"indexBounds" :

{ "custid" : [ [ 1102598027, 1102598027 ] ] }

}

Comment by jason [ 14/Feb/11 ]

http://passing.tk/index.php?q=YUhSMGNEb3ZMMmR5YjNWd2N5NW5iMjluYkdVdVkyOXRMMmR5YjNWd0wyMXZibWR2WkdJdGRYTmxjaTlpY205M2MyVmZkR2h5WldGa0wzUm9jbVZoWkM4eE5qVTNOek5qTWpJMVpqVmtOV1Zo

Difference between the two different ways of writing 100 times.
scan=189958 1.millis==394s 2.millis==3185
1.
> db.cc.find(

{custid:1102598027,price:0}

).explain()

{
"cursor" : "BtreeCursor custid_1",
"nscanned" : 189958,
"nscannedObjects" : 189958,
"n" : 189958,
"millis" : 394,
"indexBounds" :

{ "custid" : [ [ 1102598027, 1102598027 ] ] }


}

2.
> db.cc.find(

{custid:1102598027,$where:"this.price==0"}

).explain()

{
"cursor" : "BtreeCursor custid_1",
"nscanned" : 189958,
"nscannedObjects" : 189958,
"n" : 189958,
"millis" : 3185,
"indexBounds" :

{ "custid" : [ [ 1102598027, 1102598027 ] ] }

Recommended to native support find({ a:

{ $lt : b*2 }

}) ,
select * from where a<b*2
now find({$where: this.a<(this.b*2) }) so slow.....

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