You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var stream = new MemoryStream();
var dumpedString = '';
stream.on('data', function(chunk) {
dumpedString += chunk.toString();
});
temp_db.dump(stream).then(function () {
console.log('Yay, I have a dumpedString: ' + dumpedString);
}).then(function() {
return temp_db.destroy();
}).catch(function (err) {
console.log('oh no an error', err);
});
Since I was collaborating on the code above, just thought I'd add some additional observations and context. We were trying to dump the database from inside PouchDB's complete event handler, which I suspect was creating some kind of chicken-and-egg issue. Once we moved temp_db.destroy() to an external function (Ember's route's willTransition hook), the error stopped happening.
I'm curious about the actual mechanics of why you can't destroy the database from inside the complete handler. It kind of makes sense intuitively, but if that's the case, then how are you supposed to destroy a database immediately after a replication? setTimeout an anonymous function from inside the complete handler?
In the browser console I see this:
pouchdb:api tempdb +67ms destroy
pouchdb:api tempdb +1ms get _local/_pouch_dependentDbs Object { } vendor.js:80884:8
17:42:31.137 pouchdb:api tempdb +3ms get error Object { status: 404, name: "not_found", message: "missing", error: true, stack: "" }
TypeError: destructListeners.get(...) is undefined [Learn More]
Do I have to unbind something before I destroy the db? I'm using your example code inside an Ember project (desktop web browser).
The text was updated successfully, but these errors were encountered: