How do you write a query to find documents where 'status' is either 'A' or 'D'? - Study24x7
Social learning Network
5 followers study24x7 27 Dec 2024 12:41 PM study24x7 study24x7

How do you write a query to find documents where 'status' is either 'A' or 'D'?

A

db.collection.find({status: {$in: ["A", "D"]}})

B

db.collection.find({status: ["A", "D"]})

C

db.collection.find({status: {$or: ["A", "D"]}})

D

db.collection.find({$or: [{status: "A"}, {status: "D"}]})

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles