[SERVER-3192] allow nesting $or within $and Created: 03/Jun/11  Updated: 14/Nov/17  Resolved: 24/Jun/11

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Querying
Affects Version/s: None
Fix Version/s: 1.9.1

Type: New Feature Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 10
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-2585 Allow nested $or operator Closed
Related
related to SERVER-1089 $and operator Closed
is related to SERVER-1089 $and operator Closed
is related to SERVER-3327 use indexes for nested $or clauses Closed
Participants:

 Comments   
Comment by Aaron Staple [ 24/Jun/11 ]

We've added in matching for nested or clauses, but not index support. Index support is SERVER-3327.

Comment by Thomas DeMille [ 23/Jun/11 ]

I'm very hopeful this would include ability for multiple $OR? We are running into major issue implementing MongoDB for searches without multiple $or, for instance..

query = { $or: [

{ IsBankOwned: true }

,

{ IsShortSale: true }

,

{ IsHUD: true }

], $or: [

{ AreaID: "2467" }

,{ CityID: { $in: [ "4651" ] }} ] }

does not currently work so we can not use this for our search for real estate MLS where the search might be (as above) in this area OR that city AND IsBankOwned OR isShortSale

the work around is to pull back a huge dataset and use code to parse out one of the OR elements.

Thnks!

Comment by auto [ 16/Jun/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3192 a few more test cases
Branch: master
https://github.com/mongodb/mongo/commit/666397744ecbcfd1237ffe1dd454e1502ab3f60b

Comment by auto [ 16/Jun/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3192 a few more test cases
Branch: master
https://github.com/mongodb/mongo/commit/6646b9024f755ea666b5e9a5660e6c55d3705a3a

Comment by auto [ 16/Jun/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3192 a few more test cases
Branch: master
https://github.com/mongodb/mongo/commit/0956da450ca059cbee3a98c12e28aa67c6abaed7

Comment by auto [ 16/Jun/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3192 require atomic specifier to be top level
Branch: master
https://github.com/mongodb/mongo/commit/fc3f8343201cabcc1a5c99b7f6a12f5c25647b9b

Comment by auto [ 16/Jun/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3192 SERVER-2585 allow nested or clauses in queries, opaque to indexing system
Branch: master
https://github.com/mongodb/mongo/commit/0b32ad4e6d5629525001add932fe78ba517cb503

Comment by Aaron Staple [ 07/Jun/11 ]

We are planning to implement a useful portion of this functionality for 1.9.1

Comment by Luke Maurer [ 03/Jun/11 ]

I just want to emphasize: SERVER-1089 is very important to my project, but without this ability it's meaningless. In fact, it's difficult for me to construct examples where $and is necessary but nested $or is not; the best I can think of would be regular expressions, and using $and there is just a workaround for a shortcoming in the regular expression language (many regex engines support & as an operator).

So for us, and I'd have to guess for 99% of people who cared about SERVER-1089, this is just as important and just as sorely needed.

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