The following example is applicable to all Sync objects
(i.e., syncClient.document(), syncClient.list(), syncClient.map(), syncClient.stream())
// Attempts to open an existing document with a unique name of 'MyDocument'// If no such document exists, the promise is rejectedsyncClient.document({id:'MyDocument',mode:'open_existing'}) .then(...) .catch(...);// Attempts to create a new document with a unique name of 'MyDocument', TTL of 24 hours and initial data `{ name: 'John Smith' }`// If such a document already exists, the promise is rejectedsyncClient.document({id:'MyDocument',mode:'create_new',ttl:86400data: { name:'John Smith' } // the `data` property is only applicable for Documents}) .then(...) .catch(...);
Options for opening a Sync object.
The following example is applicable to all Sync objects (i.e.,
syncClient.document()
,syncClient.list()
,syncClient.map()
,syncClient.stream()
)