pouchdb size increasing whilte deleting and restoring docs -


i've noticed size of db increasing after deleting / restoring docs auto-compaction set true. do wrong?

here code:

var db = new pouchdb("mydb", {adapter: "idb", auto_compaction: true}); var docs = [{_id: "0", name: "foo1"}, {_id: "1", name: "foo2"}]; db.bulkdocs(docs).then(function() {     db.alldocs({include_docs: true}).then(function(result) {         docs = result.rows.map(function(row) {             return row.doc;         });        }; };  function remove() {     (var in docs) {         docs[i]._deleted = true;     }      return db.bulkdocs(docs);            };  function restore() {     (var in docs) {         delete docs[i]._deleted;         delete docs[i]._rev;     }      return db.bulkdocs(docs);    }  // calling function increases size of db function test() {     return remove(docs).then(restore); } 

that's not correct way delete documents pouchdb.

use: db.remove(doc, [options], [callback])

please check here

good luck


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -