- Some operations may take a long time to complete.
Those operations will run in the server background and can be awaited for completion.
- Those operations implement an interface with result type
- For those operations, the
send method returns a promise for an object that can be awaited on that Id.
// Define operation, e.g. delete all discontinued products
// Note: This operation implements: 'IOperation<OperationIdResult>'
const deleteByQueryOp = new DeleteByQueryOperation("from Products where Discontinued = true");
// Execute the operation
// 'send' returns an object that can be awaited on
const asyncOperation = await documentStore.operations.send(deleteByQueryOp);
// Call method 'waitForCompletion' to wait for operation completion