diff --git a/app.js b/app.js index 15ab24a1c..783f80457 100755 --- a/app.js +++ b/app.js @@ -74,8 +74,9 @@ if (isPro) { reconnectInterval: 1000, family: 4, - useNewUrlParser: true, // #1516 - useFindAndModify: false // #1516 + useNewUrlParser: true, // #1516 + useFindAndModify: false, // #1516 + useCreateIndex: true // #1516 } } else { dbOptions = { @@ -84,8 +85,9 @@ if (isPro) { reconnectInterval: 1000, family: 4, - useNewUrlParser: true, // #1516 - useFindAndModify: false // #1516 + useNewUrlParser: true, // #1516 + useFindAndModify: false, // #1516 + useCreateIndex: true // #1516 } } @@ -310,7 +312,8 @@ if (isSecured) { '!SRP', '!CAMELLIA' ].join(':'), - honorCipherOrder: true + honorCipherOrder: true, + secureOptions: crypto.constants.SSL_OP_NO_TLSv1_1 | crypto.constants.SSL_OP_NO_TLSv1 }; try { diff --git a/models/script.js b/models/script.js index 9634347c3..cb2ceecf3 100644 --- a/models/script.js +++ b/models/script.js @@ -38,12 +38,63 @@ var scriptSchema = new Schema({ uses: [String], _groupId: Schema.Types.ObjectId, // The group is script created _authorId: Schema.Types.ObjectId +}, +{ + autoIndex: false }); scriptSchema.virtual('_since').get(function () { return this._id.getTimestamp(); }); +/* + * Manual-indexed + */ + +scriptSchema.index({ + isLib: 1, // A lot of hits + author: 1, // Some hits + name: 1 // Very few hits +// about: 'text' // No hits period when included... only one allowed per Schema +}); // NOTE: Array indexing isn't supported with *mongoose* (yet?) + + +/* + * Auto-indexed copy + */ + +// scriptSchema.index({ // NOTE: This index is currently covered in above manual compound index +// isLib: 1 +// }); + +scriptSchema.index({ + installName: 1 +}); + +scriptSchema.index({ + _authorId: 1, + flagged: 1, + isLib: 1 +}); + +// -- + var Script = mongoose.model('Script', scriptSchema); +Script.syncIndexes(function () { + Script.collection.getIndexes({ + full: true + }).then(function(aIndexes) { + console.log('Script indexes:\n', aIndexes); + }).catch(console.error); +}); + +Script.on('index', function (aErr) { + if (aErr) { + console.error(aErr); + } else { + console.log('Index event triggered/trapped for Script model'); + } +}); + exports.Script = Script; diff --git a/package.json b/package.json index 2efe9d082..c1090bde1 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "clean": "node dev/clean.js" }, "engines": { - "node": ">=12.0.0 <13.0.0", + "node": ">=10.16.0 <11.0.0", "npm": ">=6.9.0" }, "private": true