mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
fix: returnOriginal deprecation
https://github.com/mongodb/node-mongodb-native/pull/2808
This commit is contained in:
@@ -222,7 +222,15 @@ module.exports = function (module) {
|
||||
return result.map(data => data && data[field]);
|
||||
}
|
||||
|
||||
const result = await module.client.collection('objects').findOneAndUpdate({ _key: key }, { $inc: increment }, { returnOriginal: false, upsert: true });
|
||||
const result = await module.client.collection('objects').findOneAndUpdate({
|
||||
_key: key,
|
||||
}, {
|
||||
$inc: increment,
|
||||
}, {
|
||||
returnDocument: 'after',
|
||||
upsert: true,
|
||||
});
|
||||
|
||||
cache.del(key);
|
||||
return result && result.value ? result.value[field] : null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user