0

I've scoured the docs and google. Maybe I just need help formulating the question.

I have a field that stores an array of values. We'll call it "tags" for simplicity. I want to be able to search for all documents that match ANY of the multiple tags I search on. Put another way, I want to find all records that are tagged with at least one (not necessarily all) of these tags. Here's an example.

Documents :

{name: "My Thing 1", tags: ["cool", "important", "anothertag"]},
{name: "My Thing 2", tags: ["cool"]},
{name: "My Thing 3", tags: ["cool", "important"]}
{name: "My Thing 4", tags: ["important", "anothertag"]}
{name: "My Thing 5", tags: []}
{name: "My Thing 6", tags: ["anothertag"]}

Query: ["important", "cool"]

Result: documents 1-4 (not 5-6)

whoami - fakeFaceTrueSoul
  • 17,086
  • 6
  • 32
  • 46
Taylor Vance
  • 706
  • 1
  • 8
  • 22

1 Answers1

0

See comment by whoami. $in does the trick.

Taylor Vance
  • 706
  • 1
  • 8
  • 22