1

suppose I have s mongo database:

[ { name: tom, tags: ["a","b"] } { name: lee, tags: ["b","c", "d"] } { name: jack, tags: ["c","d"] } ] 

I want to find the object which the tags include b, like the above tom and lee

so what query sentence I can use?

1 Answer 1

2
db.collection.find({ tags: "b" }) 

Simple as that.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.