0
Person = { name: string}
const names = {John, Mark, Fady}

how to make a find query to get all the persons that their names are in the array? i could make a loop over the array and make a find query for every element but this will not be efficient since it will make N find queries.

1 Answer 1

2

db.collection.find( { name: { $in: ['John', 'Mark', 'Fady' ] } } )

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.