WIP: use async functions from persistence module in datastore

Timothée Rebours 3 years ago
parent 161c2da7d7
commit 81beec47e7
  1. 7
      lib/datastore.js

@ -610,12 +610,7 @@ class Datastore extends EventEmitter {
// Update the datafile
const updatedDocs = modifications.map(x => x.newDoc)
await new Promise((resolve, reject) => {
this.persistence.persistNewState(updatedDocs, err => {
if (err) return reject(err)
else resolve()
})
})
await this.persistence.persistNewStateAsync(updatedDocs)
if (!options.returnUpdatedDocs) return { numAffected: numReplaced }
else {
let updatedDocsDC = []

Loading…
Cancel
Save