Edit Page

.manager

The live connection manager for this datastore.

datastore.manager

Depending on the adapter, this might represent a connection pool, a single connection, or just a reference to a preconfigured client library instance.

Example

#

Access a raw Mongo collection instance representing a model Pet.

// Since the db connection manager exposed by `sails-mongo` is actually
// the same as the Mongo client's `db` instance, we can treat it as such.
var db = Pet.getDatastore().manager;

// Now we can do anything we could do with a Mongo `db` instance:
var rawMongoCollection = db.collection(Pet.tableName);

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 repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference