问题
How can I drop a database in PouchDB to get the space on the disk free again?
Remove only sets a paramter _deleted and keeps the Data of the record anyway.
But how can I delete records in a way that actually gets rid of them and saves up some space?
Because I'd like to reset the database every now and then so it doesn't get too big.
回答1:
It sounds like you are looking for compaction. It will do exactly what you describe. :)
回答2:
You can destroy the database and create it again.
var _db = new PouchDB('foo');
var reset = function() {
_db.destroy().then(function() {
_db = new PouchDB('foo');
});
};
来源:https://stackoverflow.com/questions/28630153/how-can-i-delete-pouchdb-database-indefinitly-to-free-space