Interface PatchOperations

Operations that can be applied in a patch. Used to modify existing documents.

client.patch('bike-123')
.set({inStock: false})
.inc({numSold: 1})
.unset(['price'])
.commit()
interface PatchOperations {
    dec?: { [key: string]: number };
    diffMatchPatch?: { [key: string]: any };
    ifRevisionID?: string;
    inc?: { [key: string]: number };
    insert?: InsertPatch;
    set?: { [key: string]: any };
    setIfMissing?: { [key: string]: any };
    unset?: string[];
}

Properties

dec?: { [key: string]: number }

Decrement numeric fields by the given amount

diffMatchPatch?: { [key: string]: any }

Apply diff-match-patch operations

ifRevisionID?: string

Only apply patch if document has this revision

inc?: { [key: string]: number }

Increment numeric fields by the given amount

insert?: InsertPatch

Insert items in arrays at specific positions

set?: { [key: string]: any }

Shallow merge of the provided object

setIfMissing?: { [key: string]: any }

Set fields only if they're not already present

unset?: string[]

Remove fields from the document