Replaced manual recompute calls with dirty flag settings

This commit is contained in:
Stefan Zermatten
2022-05-11 15:42:29 +02:00
parent 7a35c66904
commit 1b3efae81a
28 changed files with 138 additions and 128 deletions

View File

@@ -40,17 +40,22 @@ const restoreError = function(){
);
};
export function restore({_id, collection}){
export function restore({ _id, collection, extraUpdates}){
if (typeof collection === 'string') {
collection = getCollectionByName(collection);
}
const update = {
$unset: {
removed: 1,
removedAt: 1,
},
...extraUpdates
}
let numUpdated = collection.update({
_id,
removedWith: {$exists: false}
}, { $unset: {
removed: 1,
removedAt: 1,
}}, {
}, update , {
selector: {type: 'any'},
},);
if (numUpdated === 0) restoreError();