Using MongoDB…
If I have an array of ids in one field, can I quickly query it for containing id_x?
If so how would I insure and index on it so it is as fast as possible?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can just build an index on that field. That the key has multiple values makes no difference in how you do that. They call this the Multikey feature.
And the query is the same as well:
It just happens to hit any document which has (at least) that tag.