feat: #8823, remove hardcoded write concern

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 518d4fa170
commit a338f52780

@ -20,7 +20,7 @@ module.exports = function (module) {
key.forEach(key => bulk.find({ _key: key }).upsert().updateOne({ $set: writeData }));
await bulk.execute();
} else {
await module.client.collection('objects').updateOne({ _key: key }, { $set: writeData }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $set: writeData }, { upsert: true });
}
} catch (err) {
if (err && err.message.startsWith('E11000 duplicate key error')) {

@ -12,7 +12,7 @@ module.exports = function (module) {
const exists = await module.isObjectField(key, 'array');
if (exists) {
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: { $each: [value], $position: 0 } } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: { $each: [value], $position: 0 } } }, { upsert: true });
} else {
await module.listAppend(key, value);
}
@ -23,7 +23,7 @@ module.exports = function (module) {
return;
}
value = helpers.valueToString(value);
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: value } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: value } }, { upsert: true });
};
module.listRemoveLast = async function (key) {

@ -22,7 +22,6 @@ module.exports = function (module) {
},
}, {
upsert: true,
w: 1,
});
};

@ -17,7 +17,7 @@ module.exports = function (module) {
value = helpers.valueToString(value);
try {
await module.client.collection('objects').updateOne({ _key: key, value: value }, { $set: { score: parseFloat(score) } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key, value: value }, { $set: { score: parseFloat(score) } }, { upsert: true });
} catch (err) {
if (err && err.message.startsWith('E11000 duplicate key error')) {
return await module.sortedSetAdd(key, score, value);

Loading…
Cancel
Save