Closed
Description
Hello, I've been playing with this a bit, love it!
The functionality I'm missing is to do updates in a mongo update(matcher, changes) manner. I've built a simple solution for that stealing some code from minimongo. Would you be willing to take a PR? Or is a lack of update a design decision?
What I'm doing now is:
users.find(matchingQuery).exec().then(function (docs) {
docs.forEach(function (doc, index) {
const newDoc = { ...doc._data }
modify(newDoc, setQuery);
delete newDoc._rev;
delete newDoc._id;
Object.keys(newDoc).forEach((el) => {
doc[el] = newDoc[el];
});
doc.save()
});
});
setQuery can be {$set: {}}, or use $rename, $pullAll $pop $push $unset etc.
modify changes the newDoc according to the setQuery.
I'm thinking of making the modify a standalone package, that would take a doc and return a new one, that could be a dependency in rxdb, and then I'd just add a simple update method. If not needed - not a problem! I will just polish it a bit for my own use :)