mongodb $or for array items
// Documents
[{
...,
id: "doc1",
tags: ["tag 1", "tag 2"]
}]
// Find documents which match all input tags
const inputTags = ["tag 1", "tag 2"]
const results = await Collection.find({
tags: {
$all: inputTags
}
})
// Find documents which include at least one tag from input tags
const results = await Collection.find({
tags: {
$in: inputTags
}
})