[SERVER-1036] $in does not work with nested arrays Created: 21/Apr/10  Updated: 08/Mar/13  Resolved: 26/Nov/12

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

Type: Bug Priority: Minor - P4
Reporter: Christian Wyglendowski Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

32-bit 1.3.5 in staging/test environment


Participants:

 Description   

I have some documents for which I'd like to use composite fields. Something like:

{id:['x', 1], value:1234}

and

{id:['y', 2], value:4321}

.

The idea is that I can pull both of those docs by saying:

db.clxn.find({id:{$in:[['x', 1], ['y', 2]]}}).

That would let me select just those two in a single query. It doesn't work though. I get no results back using both the JS console and Pymongo.

This can't be solved by making each component of the composite field into separate fields either. If they were individual fields id_str and id_int and I did:

db.clxn.find({id_str:{$in:['x', 'y']}, id_int:{$in:[1,2]}})

I might get back up to 4 documents.



 Comments   
Comment by Aaron Staple [ 26/Nov/12 ]

The requested behavior was implemented in 2.0.

Comment by Eliot Horowitz (Inactive) [ 21/Apr/10 ]

This will work with nester objects instead of arrays.
Not sure if this makes sense in general.

Comment by Christian Wyglendowski [ 21/Apr/10 ]

If I use sub documents for the composite fields I can accomplish what I want. Feel free to close this if it seems superfluous now.

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