如何無限地刪除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 联系我们: