Destroy all _deleted documents - Agrejus/pouchdb-entity-fabric GitHub Wiki
By default, PouchDB does not permanently delete any documents. Any deleted documents are marked with a _deleted flag and cannot be retrieved. To permanently delete these documents, purge() can be used.
Memory Purge
Memory purge is used by default if no option is supplied. A memory purge consists of moving all data in the underlying database to an in memory database, destroying the original database, reinserting the data in the in memory database, and then destroying the in memory database.
export class PouchDbDataContext extends DataContext<DocumentTypes> {
myFirstDbSet = this.dbset().default<IMyFirstEntity>(DocumentTypes.MyFirstDocument).create();
}
const context = new PouchDbDataContext();
await context.purge("memory");
// or
await context.purge();
Disk Purge
Disk purge should be used if the database has large amounts of data. A disk purge consists of moving all data in the underlying database to an disk database, destroying the original database, reinserting the data in the disk database, and then destroying the disk database.
export class PouchDbDataContext extends DataContext<DocumentTypes> {
myFirstDbSet = this.dbset().default<IMyFirstEntity>(DocumentTypes.MyFirstDocument).create();
}
const context = new PouchDbDataContext();
await context.purge("disk");