Mongoose 4.x "model.update()" callback changed Mongoose 4.x "model.update()" callback changed mongodb mongodb

Mongoose 4.x "model.update()" callback changed


Yes, they are the same thing. According to the 4.0 release notes:

#2552: Upgraded mongodb driver to 2.0.x. Mongoose is a wrapper layer on top of the MongoDB node driver. The mongodb driver recently released version 2.0, which includes numerous performance and usability improvements. The new driver, however, introduces a few changes that affect the way you use Mongoose:

  • If you are connecting to a replica set, you must specify the replicaSet option in the connection string.
  • update returns a result object from the MongoDB server, rather than just the number affected. The second parameter to the callback will now look like { ok: 1, n: 3 } rather than simply the number affected.