Mongoose 5 (#9870)

* mongoose 5: remove unused autoinc, remove promise option (it uses native promises now)

* remove mongodb package

* remove mongoskin

* migrate migration away from mongoskin

* fix mongoose hooks

* fix _updateUserWithRetries

* try without next

* remove init

* update sinon

* fix some integration tests

* fix remaining tests

* fix error message

* fix error message

* fix error message

* another fix

* fix mongoose options

* remove greenkeeper exception
This commit is contained in:
Matteo Pagliazzi
2018-03-09 13:13:58 -08:00
committed by Sabe Jones
parent f9a47b1420
commit 1332fd68b0
6 changed files with 3506 additions and 2190 deletions

View File

@@ -1,20 +1,15 @@
import nconf from 'nconf';
import logger from './logger';
import mongoose from 'mongoose';
import Bluebird from 'bluebird';
const IS_PROD = nconf.get('IS_PROD');
const MAINTENANCE_MODE = nconf.get('MAINTENANCE_MODE');
// Use Q promises instead of mpromise in mongoose
mongoose.Promise = Bluebird;
// Do not connect to MongoDB when in maintenance mode
if (MAINTENANCE_MODE !== 'true') {
const mongooseOptions = !IS_PROD ? {} : {
keepAlive: 120,
connectTimeoutMS: 30000,
useMongoClient: true,
};
const NODE_DB_URI = nconf.get('IS_TEST') ? nconf.get('TEST_DB_URI') : nconf.get('NODE_DB_URI');