Skip to main content

Function: isInternalDoc()

function isInternalDoc(doc, options): boolean;

Defined in: packages/client/src/core/sync/internal-docs.ts:230

Reports whether a document describes device-local state rather than stack data.

Parameters

ParameterTypeDescription
docMaybeInternalDocThe document to classify. A missing or id-less value counts as internal, so a malformed change never escapes to a remote.
optionsInternalDocFilterOptionsWhich of the optional categories to treat as replicable.

Returns

boolean

true when the document should stay on this device.

Example

isInternalDoc({ _id: "~system" }); // true
isInternalDoc({ _id: "Task-1", "~class": "Task" }); // false
isInternalDoc({ _id: "sess-a", "~class": "~UserSession" }); // true
isInternalDoc({ _id: "sess-a", "~class": "~UserSession" }, { replicateSessions: true }); // false