It sounds like you're looking for the .native
method, which returns the raw node mongo
collection instance. This allows you to use native Mongo methods. For example, if you a User
model in Sails, you would do:
User.native(function(err, userCollection) {
userCollection.aggregate(...)
}
Docs for the native Node Mongo driver are here, including a section on how to do aggregation.
Docs for the .native
method are on the sailsjs.org.