Page 1 of 1

Query with $in and pointer field

Posted: Sat Oct 11, 2014 11:39 am
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


Query with $in and pointer field

Posted: Mon Oct 13, 2014 8:29 am
by Kateryna Grynko

Hi Mantas,

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


Query with $in and pointer field

Posted: Mon Oct 13, 2014 10:47 am
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


Query with $in and pointer field

Posted: Tue Oct 14, 2014 5:13 pm
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"}}?


Query with $in and pointer field

Posted: Tue Oct 14, 2014 6:32 pm
by Mantas Kamarauskas

Maryna,

looks like I found correct way. Thanks anyway.

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


Query with $in and pointer field

Posted: Tue Oct 14, 2014 6:34 pm
by Evgene Karachevtsev

Hello Mantas,

Thank you for the update, glad it works!