overleaf/services/web/app/coffee/infrastructure/Mongoose.coffee
Shane Kilkelly 035e0c1213 Add autoIndex: false option to mongoose connections.
This prevents mongoose from auto-creating missing indexes on boot.
2017-11-22 13:37:57 +00:00

19 lines
553 B
CoffeeScript

mongoose = require('mongoose')
Settings = require 'settings-sharelatex'
logger = require('logger-sharelatex')
mongoose.connect(Settings.mongo.url, {
server: {poolSize: 10},
config: {autoIndex: false}
})
mongoose.connection.on 'connected', () ->
logger.log {url:Settings.mongo.url}, 'mongoose default connection open'
mongoose.connection.on 'error', (err) ->
logger.err err:err, 'mongoose error on default connection';
mongoose.connection.on 'disconnected', () ->
logger.log 'mongoose default connection disconnected'
module.exports = mongoose