sergeyksv / tingodb

Embedded Node.js database upward compatible with MongoDB
www.tingodb.com
1.16k stars 105 forks source link

Safe Persistence - append only. How to compact Db while running? #182

Closed pdelbeato closed 4 years ago

pdelbeato commented 4 years ago

As wrote on the website "Safe persistence: TingoDB uses append only files for storing of collection documents. This ensures that you never lost all your data and can rollback to good copy if any damage happens." and that is perfect. But, considering my program runs for days and days, db size starts to grow in an unbearable manner. Is there a method to call a "compactation" of the db, as if I load it from zero? A sort of db.collection.compact(). Or do I have to close a db and open it again? Thanks.

sergeyksv commented 4 years ago

compactCollection on collection or compactDatabase on database (will compact all collections). Note that this operation is non destructive (can be called in realtime) but can take quite some time and will block all read and write operations while it running.