Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: print DeprecationWarning #301

Merged
merged 2 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
================

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion test/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function noop() {}

describe('Events', () => {
let store, collection
beforeEach(done => {
beforeEach(function (done) {
this.timeout(10000)
store = new MongoStore({
url: connectionString,
collection: 'sessions-test'
Expand Down