-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.4.4
-
Component/s: Querying
-
Labels:None
-
ALL
I have a compound key. Searching it directly works just fine.
find({_id : { a:'1', b:'2' }}) -> 1 doc
As I want to get a couple of documents in on query, varying on the second part of the key I tried
find({_id : { a:'1', b: { $in: ['2'] }}) -> 0 docs
while this was expected to give the very same result. After lots of tries I found that only
find({ _id: { $in: [
{ a: '1', b: '2' }] ]}) -> 1 docs
works. Which essentially means one needs to send a lot of duplicated data in a query.
find({ _id: { $in: [
{ a: '1', b: '1' },
{ a: '1', b: '2' },
{ a: '1', b: '3' },
{ a: '1', b: '4' }] ]}) -> 4 docs
Even worse - there is no error message or reason given why the $in operator does not work in compound keys.
Could be related to http://jira.mongodb.org/browse/SERVER-1026