According to the .native() documentation, the way to use .native() query for sails-mongo is :
Pet.native(function(err, collection) {
if (err) return res.serverError(err);
collection.find({}, {
name: true
}).toArray(function (err, results) {
if (err) return res.serverError(err);
return res.ok(results);
});
});
How can I avoid callback here and use promises instead. Note that I have to use aggregate queries, so have to use .native()