There are two applications,
- one console application keeps writing data to a litedb database continuously.
- The other console application reads data and deletes whatever was read
var liteCollection = _liteDb.GetCollection<SomeClass>("ColName");
var data = liteCollection.FindAll().ToList();
//prepare list if id's and delete
var ids = data .Select(l => l.Id).ToList();
var count = liteCollection.DeleteMany(rp => ids.Contains(rp.Id));
Everything looks great, but the database file size keeps growing and is not reducing at all. How to shrink the database?
I get to know some shrink
command, but how to use it? A liteDb.Shrink()
option I am not seeing and is not available.
- Is there any API available to shrink the database and how to use it?
- The above read and delete code I am running in loops which call every 5 minutes, can I use Shrink as well right after delete?
- Is my predicate right for
DeleteMany
or is there another way to do this as well?