I want to use runCommand in mongoDB while using mongoskin -
i want use runcommand
in mongodb while using mongoskin. doing this:
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) }) })
it's equals
db.powders.find()
but want function me this
db.runcommand({distinct: "powders", key: "color"})
can me or alternative, thanks!
use db.command().
db.command( { distinct: "powders", key: "color" }, function( err, result ) { // ... });
Comments
Post a Comment