View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page


.native() is only available when using Sails/Waterline with MongoDB.

Returns a raw Mongo collection instance representing the specified model, allowing you to perform raw Mongo queries.

For full documentation and usage examples, check out the native Node Mongo driver.

Note that sails-mongo maintains a single Mongo connection for each of your configured connections/datastores. Consequently, when using .native(), you don't need to close or open db manually. For lower-level usage, you can require('mongodb') directly.


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);



  • This method only works with Mongo! For raw functionality in SQL databases, use .query().

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book