Merge pull request #2372 from overleaf/em-mongo-connection-pool

Use the default Mongoose connection pool for all models

GitOrigin-RevId: d227b7eb36f130085c9eb1480dc07bd50ba57768
This commit is contained in:
Eric Mc Sween
2019-11-18 14:20:43 +00:00
committed by sharelatex
parent 27504d7b9d
commit bdc5360bc0
26 changed files with 78 additions and 218 deletions
+2 -8
View File
@@ -1,5 +1,4 @@
const mongoose = require('mongoose')
const Settings = require('settings-sharelatex')
const mongoose = require('../infrastructure/Mongoose')
const { Schema } = mongoose
@@ -7,9 +6,4 @@ const SystemMessageSchema = new Schema({
content: { type: String, default: '' }
})
const conn = mongoose.createConnection(Settings.mongo.url, {
server: { poolSize: Settings.mongo.poolSize || 10 },
config: { autoIndex: false }
})
exports.SystemMessage = conn.model('SystemMessage', SystemMessageSchema)
exports.SystemMessage = mongoose.model('SystemMessage', SystemMessageSchema)