rate-limiter-flexible 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RateLimiterMongo.js +9 -11
- package/package.json +1 -1
package/lib/RateLimiterMongo.js
CHANGED
|
@@ -110,11 +110,7 @@ class RateLimiterMongo extends RateLimiterStoreAbstract {
|
|
|
110
110
|
|
|
111
111
|
let doc;
|
|
112
112
|
if (typeof result.value === 'undefined') {
|
|
113
|
-
|
|
114
|
-
doc = result;
|
|
115
|
-
} else {
|
|
116
|
-
[doc] = result.ops; // ops set on replaceOne
|
|
117
|
-
}
|
|
113
|
+
doc = result;
|
|
118
114
|
} else {
|
|
119
115
|
doc = result.value;
|
|
120
116
|
}
|
|
@@ -202,13 +198,15 @@ class RateLimiterMongo extends RateLimiterStoreAbstract {
|
|
|
202
198
|
key,
|
|
203
199
|
}, docAttrs);
|
|
204
200
|
|
|
205
|
-
const replaceTo =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
const replaceTo = {
|
|
202
|
+
$set: Object.assign({
|
|
203
|
+
key,
|
|
204
|
+
points,
|
|
205
|
+
expire: msDuration > 0 ? new Date(Date.now() + msDuration) : null,
|
|
206
|
+
}, docAttrs)
|
|
207
|
+
};
|
|
210
208
|
|
|
211
|
-
this._collection.
|
|
209
|
+
this._collection.findOneAndUpdate(
|
|
212
210
|
replaceWhere,
|
|
213
211
|
replaceTo,
|
|
214
212
|
upsertOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rate-limiter-flexible",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, PostgreSQL, Cluster or PM",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|