じまろぐ

めめ

resolve mongoose warning

version

4.12.5

warning

DeprecationWarning: open() is deprecated in mongoose >= 4.11.0, use openUri() instead, or set the useMongoClient option if using connect() or createConnection()

and

DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

fix

mongoose.connect(mongoURL, {
  useMongoClient: true
})

and

mongoose.Promise = require('bluebird')

link

https://github.com/Automattic/mongoose/issues/5399

https://github.com/Automattic/mongoose/issues/4951

f:id:nakajmg:20171128172739p:plain

Upgrading is not always the best option.

lol