-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
5.0 Deprecation Warnings
The following functionality is considered deprecated for the 5.0 release.
-
The mpromise promises library. Mongoose 5.0 will use native promises by default if available, otherwise no promises. You will still be able to set a custom promises library using
mongoose.Promise = require('bluebird');
, however, mpromise will not be supported. -
3512: Throwing cast errors when calling
.update()
. Mongoose 4.x currently throws an exception if the criteria or update passed toMyModel.update()
fails to cast. Mongoose 5.0 will communicate this error in the callback (or by rejecting the promise). -
The current
emitIndexError
option for schemas will be removed. Mongoose will always use theemitIndexError: true
behavior. -
For asynchronous custom validators, you will have to return a promise from the validator or specify
isAsync: true
. Mongoose will no longer treat custom validator functions that take 2 arguments as asynchronous. See GitHub issue #4084 -
The
.stream()
function for queries. Mongoose 4.5.0 queries have a.cursor()
function that uses Streams3 (rather than node 0.8 streams) among other powerful features. See GitHub issue #1907 -
The various
retainKeyOrder
options. Mongoose will not reverse key orders in 5.0. -
The
passRawResult
option tofindOneAndUpdate()
, userawResult
instead. TherawResult
option will return the raw write op result from the MongoDB driver, with the caveat thatresult.value
will be a hydrated mongoose document. See GitHub issue #4925. BothrawResult
andpassRawResult
are supported in >= 4.9.0 (passRawResult
takes precedent), however,passRawResult
will not work in 5.0.0.