Node.js 我如何在mongoDB中编写代码查询?

Node.js 我如何在mongoDB中编写代码查询?,node.js,mongodb,mongoose,Node.js,Mongodb,Mongoose,我使用的是mongoDB(使用Mongoose中间件),其中包含以下格式的集合 { _id : ObjectId("1"), tag: 'A038', flag: 'P', size: 60, name: 'productA' } { _id : ObjectId("2"), tag: 'A038', flag: 'R', size: 60, name: 'productA' } { _id : ObjectId("3"), tag: 'A039', flag: 'P', size: 60, n

我使用的是mongoDB(使用Mongoose中间件),其中包含以下格式的集合

{ _id : ObjectId("1"), tag: 'A038', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("2"), tag: 'A038', flag: 'R', size: 60, name: 'productA' }
{ _id : ObjectId("3"), tag: 'A039', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("4"), tag: 'A040', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("5"), tag: 'A040', flag: 'R', size: 60, name: 'productA' }
{ _id : ObjectId("6"), tag: 'A041', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("7"), tag: 'A042', flag: 'P', size: 60, name: 'productA' }
在那件收藏品上, 我如何在mongoDB中编写代码查询? 为了得到这样的记录

{ _id : ObjectId("3"), tag: 'A039', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("6"), tag: 'A041', flag: 'P', size: 60, name: 'productA' }
{ _id : ObjectId("7"), tag: 'A042', flag: 'P', size: 60, name: 'productA' }
在mongodb有可能吗

多谢各位


WJ

你写了什么查询?
collection.find({_id:{"$in":[ObjectId("3"),ObjectId("6"),ObjectId("7")]}},function(err,results){
console.log(results);
})