Query with $in and pointer field

This forum contains topics that were moved from Get Satisfaction
Mantas Kamarauskas
Posts: 0
Joined: Fri Aug 15, 2014 1:21 pm

Query with $in and pointer field

Post by Mantas Kamarauskas »

Hi,

I want to build query with where clause which uses data from array. For this I plan to use $in operator. The problem that when I use $in query gives no records.

Where clause bellow works perfectly:
{"ActionPointer":{"collName":"Actions", "_id":"53faf8d5e4b003453216fc59"}}}

Where clause bellow (which to my understanding is the same as above) gives no records:
{"ActionPointer":{"collName":"Actions", "_id":{"$in" :["53faf8d5e4b003453216fc59"]}}}

Is that my some mistake or is there any other way how to use $in operator on pointer values?

Best regards,
Mantas

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Query with $in and pointer field

Post by Kateryna Grynko »

Hi Mantas,

We are sorry, this is a bug.
We'll fix it.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Query with $in and pointer field

Post by Maryna Brodina »

Hello Mantas,

Sorry for misunderstanding, but it is not a bug.
Correct syntax would be like this:

pre{"ActionPointer": {"$in": ['538a4a57e4b0d8c87ceb6b1f','53a9163ce4b09f5c7d4f25ae']}}/pre

Mantas Kamarauskas
Posts: 0
Joined: Fri Aug 15, 2014 1:21 pm

Query with $in and pointer field

Post by Mantas Kamarauskas »

Hi Maryna,

for me your suggested solution does not work. It works perfectly on other types of fields (like string), but does not work on pointer type.

Isn't it that for pointer field syntax should be like {"subtask": {"collName":"todo", "_id":"5278ef66e4b01085e4b79482"}}?

Mantas Kamarauskas
Posts: 0
Joined: Fri Aug 15, 2014 1:21 pm

Query with $in and pointer field

Post by Mantas Kamarauskas »

Maryna,

looks like I found correct way. Thanks anyway.

code
{"ActionPointer":{"$inQuery" :{"_id":{"$in":["53d3cae5e4b0c27c0039ec4c","53d3cd47e4b0c27c0039ec5b"]}}}}
/code

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Query with $in and pointer field

Post by Evgene Karachevtsev »

Hello Mantas,

Thank you for the update, glad it works!

Post Reply