sails.js

MongoDB Adapter for Sails

Configuration

You can configure the database settings in config/connections.js.

Example:

someMongoDb: {
  adapter: 'sails-mongo',
  host: 'localhost', // defaults to `localhost` if omitted
  port: 27017, // defaults to 27017 if omitted
  user: 'username_here', // or omit if not relevant
  password: 'password_here', // or omit if not relevant
  database: 'database_name_here' // or omit if not relevant
}

Alternatively, you can specify your Mongo configuration as a URL

someMongoDb: {
  adapter: 'sails-mongo',
  url: mongodb://username:password@hostname:port/database
}

Installation

Install from NPM.

npm install sails-mongo --save

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow