I'm trying to bulk update some RxDB docs, since RxDB does not have a bulk update function I have to use the bulkDocs function on the built in pouchdb instance. I can successfully do this but then my revisions are out of sync. Is there a way to sync rxdb revisions with pouchdb when using the pouchdb instance?
My code:
async bulkUpdate(docs) {
let db = await ProjectDB.get();
let data = [];
let nodeDocs = await db.collections.nodes.find().exec();
_.each(docs, doc => {
let matchingDoc = _.find(nodeDocs, n => {return n.id === doc._id});
if (matchingDoc) {
data.push(_.omit(_.assign({_id: matchingDoc.id, _rev: matchingDoc.revision}, matchingDoc.toJSON(), doc), "id"));
}
});
await db.collections.nodes.pouch.bulkDocs({docs: data}, {force: true}).then(docs => {
_.each(docs, doc => {
console.log(doc);
})
})
}