From 36f42e535da9b2d260022bebc7c64595c4591d1d Mon Sep 17 00:00:00 2001 From: ksh-code Date: Tue, 18 Sep 2018 11:39:36 +0900 Subject: [PATCH] Fix: print 'DeprecationWarning' error --- CHANGELOG.md | 5 +++++ README.md | 2 +- package.json | 2 +- src/index.js | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b744746..775a57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2.0.2 / 2018-09-18 +================ + +* __Fix__ #300 DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead +* __Fix__ #297 DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead 2.0.1 / 2018-01-04 ================ diff --git a/README.md b/README.md index 40c94ff..01ceb5e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ MongoDB session store for [Connect](https://github.com/senchalabs/connect) and [ * Support all Connect versions * Support [Mongoose](http://mongoosejs.com/index.html) `>= 4.1.2+` * Support [native MongoDB driver](http://mongodb.github.io/node-mongodb-native/) `>= 2.0.36` -* Support Node.js 4, 6 and 8 +* Support Node.js 4, 6, 8 and 10 * Support [MongoDB](https://www.mongodb.com/) `>= 3.0` For extended compatibility, see previous versions. diff --git a/package.json b/package.json index 4351e93..011ef33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "connect-mongo", - "version": "2.0.1", + "version": "2.0.2", "description": "MongoDB session store for Express and Connect", "keywords": [ "connect", diff --git a/src/index.js b/src/index.js index 842d305..092a7a1 100644 --- a/src/index.js +++ b/src/index.js @@ -240,7 +240,7 @@ module.exports = function (connect) { } return withCallback(this.collectionReady() - .then(collection => collection.update({_id: this.computeStorageId(sid)}, s, {upsert: true})) + .then(collection => collection.updateOne({_id: this.computeStorageId(sid)}, s, {upsert: true})) .then(rawResponse => { if (rawResponse.result) { rawResponse = rawResponse.result @@ -280,7 +280,7 @@ module.exports = function (connect) { } return withCallback(this.collectionReady() - .then(collection => collection.update({_id: this.computeStorageId(sid)}, {$set: updateFields})) + .then(collection => collection.updateOne({_id: this.computeStorageId(sid)}, {$set: updateFields})) .then(result => { if (result.nModified === 0) { throw new Error('Unable to find the session to touch') @@ -293,7 +293,7 @@ module.exports = function (connect) { destroy(sid, callback) { return withCallback(this.collectionReady() - .then(collection => collection.remove({_id: this.computeStorageId(sid)})) + .then(collection => collection.deleteOne({_id: this.computeStorageId(sid)})) .then(() => this.emit('destroy', sid)) , callback) }