[SERVER-41354] Resultset change with 2x $or clauses at same level Created: 29/May/19 Updated: 11/Jun/19 Resolved: 29/May/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 3.6.12 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrea Bozzetto | Assignee: | Eric Sedor |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: | Below the insert Script }} }} ], , ] } , ], , ] |
||||||||
| Participants: | |||||||||
| Description |
|
Hi, |
| Comments |
| Comment by Eric Sedor [ 29/May/19 ] | |||||||||||||||||||||
|
I believe the expected way to write this $or query is:
I may have misunderstood the logic you are encoding, but the important part of my suggestion is that only one $or operator can be provided at any particular depth of the query document (the top level in this case). The unpredictable behavior you are seeing is due to one $or clause overwriting the other at the top level. You would see similar unpredictability if you queried for db.test.find({"status" : "current", "status":"other"}) SERVER-6439 is tracking a request to disallow this sort of document, so I am closing this ticket as a duplicate of that issue. For further discussion about how to use specific MongoDB features, please ask our community by posting on the mongodb-user group or on Stack Overflow with the mongodb tag. The SERVER project is for reporting bugs and feature requests. |