我想在使用mongoskin时runCommand
在mongoDB中使用。目前我正在做这样的事情:
app.get('/api/powders', function(req, res, next) {
db.collection('powders').find({} ,{limit:0, sort: [['_id',-1]]}).toArray(function(e, results){
if (e) return next(e)
res.send(results)
})
})
它等于
db.powders.find()
但我想要一个可以做到这一点的功能
db.runCommand({distinct: "powders", key: "color"})
任何人都可以帮助我或任何替代方案,谢谢!