Skip to content

Commit

Permalink
Merge pull request #38 from 2do2go/refactor/use-return-document
Browse files Browse the repository at this point in the history
Refactor: Use findOneAndUpdate with returnDocument
  • Loading branch information
okv authored Sep 11, 2021
2 parents 4363afb + 5ee457a commit f197aa3
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 42 deletions.
4 changes: 2 additions & 2 deletions lib/mongoStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ MongoStore.prototype.incr = function(key, callback) {
modifier,
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
},
this.slot()
);
Expand Down Expand Up @@ -201,7 +201,7 @@ MongoStore.prototype.decrement = function(key) {
modifier,
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
},
this.slot()
);
Expand Down
119 changes: 87 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"mongodb"
],
"dependencies": {
"mongodb": ">= 3.3.4 < 4.0.0",
"mongodb": "^3.6.7",
"twostep": "0.4.2",
"underscore": "1.12.1"
},
Expand Down
2 changes: 1 addition & 1 deletion test/mongoStore/decrement/withFindOneAndUpdateError.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
2 changes: 1 addition & 1 deletion test/mongoStore/decrement/withResetExpireDateOnCange.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
2 changes: 1 addition & 1 deletion test/mongoStore/incr/withFindOneAndUpdateError.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
2 changes: 1 addition & 1 deletion test/mongoStore/incr/withResetExpireDateOnCange.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down
2 changes: 1 addition & 1 deletion test/mongoStore/incr/withoutResetExpireDateOnChange.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe(describeTitle, function() {
},
{
upsert: true,
returnOriginal: false
returnDocument: 'after'
}
]);

Expand Down

0 comments on commit f197aa3

Please sign in to comment.