September 2017
Intermediate to advanced
450 pages
11h 24m
English
MongoDB supports many different configuration options that can be set up when connecting to your MongoDB database with Mongoose. These options can provide support for database authentication, working with multiple databases, and database replication. These options are provided through a configuration object to mongoose.connect, or the imported mongoose node module itself:
var mongoose = require('mongoose');var options = { db: { native_parser: true }, server: { poolSize: 5, socketOptions: { keepAlive: 1} }, replset: { rs_name: 'myReplicaSetName' }, user: 'myUserName', pass: 'myPassword', auth: { authdb: 'admin'} mongos: false} mongoose.Promise = require('bluebird');mongoose.connect('mongodb://localhost/mean-db', options); ...
Read now
Unlock full access