如何无限地删除PouchDB数据库,以释放空间?

[英]How can I delete PouchDB Database indefinitly, to free space?


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.

如何在PouchDB中删除数据库以再次释放磁盘空间?删除仅设置参数_deleted并保留记录的数据。但是,如何以实际摆脱它们并节省一些空间的方式删除记录?因为我想不时地重置数据库所以它不会太大。

2 个解决方案

#1


7  

It sounds like you are looking for compaction. It will do exactly what you describe. :)

听起来你正在寻找压实。它将完全按照你的描述。 :)

#2


6  

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://www.itdaan.com/blog/2015/02/20/30c4d3125fcabdcc22f707cc6c489183.html



 
  © 2014-2022 ITdaan.com 联系我们: