简体   繁体   中英

PouchDB data not deleted after destroy

In a winJS application, i want to reset the database without restarting the app. I perform a destroy on a pouchdb with following code

function destroyPouch() {
    db.destroy(function (err, res) {
        if (res.ok) {
            resetPouch();
        }
    });

 function resetPouch() {
    db = null;
    db = new PouchDB('test-db', { adapter: 'idb', auto_compaction: true });
}

When i add new data to the pouchdb, during debug, i see in the properties of db that the _docCount still is the original number of documents stored in the pouchDB.

Also, when adding new data, i get InvalidStateErrors.

Can someone please help me to reset this database without having to shutdown the application?

Thx

_docCount is an internal detail. When you do db.info().then(console.log.bind(console)) , do you still see the old doc_count ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM