mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
Add autoIndex: false option to mongoose connections.
This prevents mongoose from auto-creating missing indexes on boot.
This commit is contained in:
@@ -2,7 +2,10 @@ mongoose = require('mongoose')
|
||||
Settings = require 'settings-sharelatex'
|
||||
logger = require('logger-sharelatex')
|
||||
|
||||
mongoose.connect(Settings.mongo.url, server: poolSize: 10)
|
||||
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'
|
||||
|
||||
@@ -73,12 +73,14 @@ applyToAllFilesRecursivly = ProjectSchema.statics.applyToAllFilesRecursivly = (f
|
||||
_.each folder.folders, (folder)->
|
||||
applyToAllFilesRecursivly(folder, fun)
|
||||
|
||||
|
||||
ProjectSchema.methods.getSafeProjectName = ->
|
||||
safeProjectName = this.name.replace(new RegExp("\\W", "g"), '_')
|
||||
return sanitize.escape(safeProjectName)
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
Project = conn.model('Project', ProjectSchema)
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@ ProjectInviteSchema = new Schema(
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
ProjectInvite = conn.model('ProjectInvite', ProjectInviteSchema)
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@ SubscriptionSchema.statics.findAndModify = (query, update, callback)->
|
||||
this.update query, update, ->
|
||||
self.findOne query, callback
|
||||
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
Subscription = conn.model('Subscription', SubscriptionSchema)
|
||||
|
||||
mongoose.model 'Subscription', SubscriptionSchema
|
||||
exports.Subscription = Subscription
|
||||
exports.SubscriptionSchema = SubscriptionSchema
|
||||
exports.SubscriptionSchema = SubscriptionSchema
|
||||
|
||||
@@ -6,7 +6,11 @@ ObjectId = Schema.ObjectId
|
||||
|
||||
SystemMessageSchema = new Schema
|
||||
content : type: String, default:''
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
|
||||
exports.SystemMessage = conn.model('SystemMessage', SystemMessageSchema)
|
||||
|
||||
@@ -64,7 +64,10 @@ UserSchema = new Schema
|
||||
accessToken: { type: String }
|
||||
refreshToken: { type: String }
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: 10)
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
User = conn.model('User', UserSchema)
|
||||
|
||||
|
||||
@@ -9,7 +9,10 @@ UserStubSchema = new Schema
|
||||
last_name : { type : String, default : '' }
|
||||
overleaf : { id: { type: Number } }
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: 10)
|
||||
conn = mongoose.createConnection(Settings.mongo.url, {
|
||||
server: {poolSize: Settings.mongo.poolSize || 10},
|
||||
config: {autoIndex: false}
|
||||
})
|
||||
|
||||
UserStub = conn.model('UserStub', UserStubSchema)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user