0

I have this collection

let tradeSchema = new mongoose.Schema({
    status: String,
});
var Trade = mongoose.model('Trade', tradeSchema, 'trade')

module.exports = Trade;

status can be 'a', 'b','c' How can I find status 'a' and 'b' with single query?

Trade.find({
    status: 
  })
  • 1
    You could use [$or](https://docs.mongodb.com/manual/reference/operator/query/or/index.html#or) or [$in](https://docs.mongodb.com/manual/reference/operator/aggregation/in/index.html#in-aggregation) – Joe Apr 14 '20 at 11:44
  • @Joe I did it. Thanks – Tiến Đạt Hoàng Apr 14 '20 at 13:25
  • Does this answer your question? [Mongodb : $in operator vs lot of single queries](https://stackoverflow.com/questions/8219409/mongodb-in-operator-vs-lot-of-single-queries) Just making this as duplicate !! – whoami - fakeFaceTrueSoul Apr 14 '20 at 16:40

0 Answers0