Function: createReplicationFilter()
function createReplicationFilter(options): (doc) => boolean;
Defined in: packages/client/src/core/sync/internal-docs.ts:267
Builds the replication filter DocStack passes to PouchDB.
PouchDB filter functions use include-semantics: returning true replicates the
document. The returned function is pure and closes over nothing but the resolved
option lists, so it is safe to hand to PouchDB.replicate/PouchDB.sync, which
call it once per change on the source's changes feed.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | InternalDocFilterOptions | Which of the optional categories to treat as replicable. |
Returns
A predicate suitable for replicate's filter option.
(doc): boolean;
Parameters
| Parameter | Type |
|---|---|
doc | MaybeInternalDoc |
Returns
boolean
Example
PouchDB.sync(local, remote, { live: true, retry: true, filter: createReplicationFilter() });