Preview Changes - Agrejus/pouchdb-entity-fabric GitHub Wiki

DataContext also offers the ability to preview changes before they are saved. A copy of the changed data will be returned. It can be change/manipulated, but those changes will not be persisted to the store, because this is only a copy of the data.

export class PouchDbDataContext extends DataContext<DocumentTypes> {
    myFirstDbSet = this.dbset().default<IMyFirstEntity>(DocumentTypes.MyFirstDocument).create();
}

const context = new PouchDbDataContext();
const [addedDocument] = await context.myFirstDbSet.add({
  propertyOne: "some value",
  propertyTwo: "some other value"
});
await context.previewChanges();