[SERVER-2689] Inconsistent behavior when combining $all with other operators Created: 06/Mar/11  Updated: 15/Feb/13  Resolved: 25/Nov/12

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

Type: Bug Priority: Major - P3
Reporter: David Oliveira Assignee: Unassigned
Resolution: Duplicate Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 32bit, MongoDB 1.6.5


Attachments: File SERVER-2689.js    
Issue Links:
Duplicate
duplicates SERVER-2165 $in and $all don't work together Closed
Operating System: ALL
Participants:

 Description   

When $all is combined with other operators (ie: $in, $gt, $lt), the results are not the expected.

Example:
Having these 9 documents:

{ n: 1, x: ["a","a"] } { n: 2, x: ["a","b"] } { n: 3, x: ["a","c"] } { n: 4, x: ["b","a"] } { n: 5, x: ["b","b"] } { n: 6, x: ["b","c"] } { n: 7, x: ["c","a"] } { n: 8, x: ["c","b"] } { n: 9, x: ["c","c"] }

> db.x.find({x:{ $in: ["a","b"] }}); return all the documents
having "a" or "b" as values of the x array - 8 documents (just
the 9th document is excluded).

> db.x.find({x:{ $all: ["c"] }}); return all the documents
having "c" as value of the x array, - 5 documents (the 3, 6, 7,
8 and 9).

> db.x.find({x:{ $in: ["a","b"], $all: ["c"] }}); should return all the documents having "a" or "b" as values and having "c" as value (the 3, 6, 7 and 8) - the intersection of both queries. Instead, return nothing.

mongodb-user theread: http://groups.google.com/group/mongodb-user/browse_thread/thread/4033cd8335f7261e



 Comments   
Comment by David Oliveira [ 08/Jun/12 ]

2.0.6 seems to not have this issue. Fixed.

Comment by Shannon Weyrick [ 08/Jun/12 ]

FYI, this appears fixed as of at least 2.1.2-pre. Test case attached.

Comment by Eliot Horowitz (Inactive) [ 26/May/11 ]

Not specifically.
its on the short list of things to do, but not slotted yet.

Comment by Sebastian S. [ 25/May/11 ]

do you already have an idea, when this bug will get fixed? I'm stucked at a project at this specific point...

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