I am trying to get all submissions
documents that contain all of the tags
listed in an array.
My current code looks like this:
submissions.find({ tags: { $all => tags } })
print tags.count
However, upon running, I receive the following error on the second line:
BSON::InvalidKey at /
NilClass instances are not allowed as keys in a BSON document.
It should also be noted that the following does work as it should (though it does not achieve my desired result):
submissions.find({ tags: tags })
print tags.count
How can I fix my original code to find the wanted documents properly?