You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// SyncFnDryrun Runs a document through the sync function and returns expiry, channels doc was placed in, access map for users, roles, handler errors and sync fn exceptions.
1698
1698
// If a docID is a non empty string, the document will be fetched from the bucket, otherwise the body will be used. If both are specified, this function returns an error.
1699
1699
// The first error return value represents an error that occurs before the sync function is run. The second error return value represents an exception from the sync function.
| Yes | No | The document passed will be considered as newDoc and oldDoc will be empty |
19
+
| Yes | Yes | The document passed in the body will be newDoc and DocID will be read from the bucket/collection and will be passed as the oldDoc. If DocID doesn't exist, then oldDoc will be empty |
20
+
| No | No | Will throw an error |
21
+
| No | Yes | The docID will be passed in as the newDoc and oldDoc will be empty. If the document is not found, an error will be returned |
22
+
14
23
* Sync Gateway Application Read Only
15
24
requestBody:
16
25
content:
17
26
application/json:
18
27
schema:
19
-
$ref: ../../components/schemas.yaml#/Document
28
+
type: object
29
+
properties:
30
+
sync_function:
31
+
description: |-
32
+
A JavaScript function that defines custom access, channel, and
33
+
validation logic for documents. This function will be evaluated
34
+
by the Sync Gateway to determine document routing, access
35
+
grants, and validation outcomes during synchronization.
36
+
type: string
37
+
example: |-
38
+
function (doc, oldDoc) {
39
+
channel(doc.channels);
40
+
}
41
+
doc:
42
+
$ref: ../../components/schemas.yaml#/Document
20
43
responses:
21
44
'200':
22
45
description: Document Processed by sync function successfully
0 commit comments