I have a field _keywords
which is an array of strings. I want to get documents where _keywords
is a super-set of the query array.
For example:
db.article.insert({'_keywords': ['foo', 'foo1', 'foo2']})
I want to retrieve this record when I query subset of ['foo', 'foo1', 'foo2']
, eg: ['foo']
or ['foo1', 'foo2']
EDIT: something like:
db.article.find({'_keywords': {$contains: array}})
_keywords
contains any item in the given query array. something like:db.article.find({_keywords: {$any: ['foo1', 'foo2']}})
, which returns any documents with _keywords contains 'foo1' or 'foo2' – Evert