My database object has an optional property named tags
which is a string array. I want to write a query that returns objects if they match one of these conditions:
- They don't have a
tags
property. - They have a tags property that has at least one item included in another array called
queryTags
From reading the documentation I came up with the following but it doesn't work:
let query = {
tags: { '$or': [{'$exists': false}, {'$in': queryTags}]}
}