My doc comes with an array area Secrets

Keys1 and Keys2 are two arrays

I would like all of the paperwork where Secrets consists of any value in Keys1 AND any value in Keys2

Any advice?


There is no fantastic way to represent this question yet (by 1.1.2) - should you request out there or file an element request we are able to attempt to go cooked up.

For the time being the best choice is most likely to make use of an $in query to complete 1 / 2 of the job:

db.test.find({keys: {$in: Keys1}})

This can be done in conjunction with a $where which could perform the Keys2 part (but will not make the most of a catalog - this is exactly why it's good to complete whenever possible using the regular query syntax). This could look something similar to this:

db.test.find({keys: {$in: Keys1}, $where: "for (i in this.keys) { for (j in Keys2) { if (this.keys[i] == Keys2[j]) return true;}} return false;"})