AddToSimpleData()

Description

This function is similar to SetSimpleData but it appends to a document in the database. Its officially the PATCH and returns a PatchId

Any new keys are added to the document with the values you provided. Any keys that previously existed are unchanged. Any keys that previously existed but you also put in the mapStruct are updated to the values you set.

Syntax

AddToSimpleData(collectionName, documentName, mapStruct)

Returns

Number  // a positive integer you can note down

Example Implementation

var playerInfo = {
    age : 21
}

var patchId = SetSimpleData("users", "lilshake", playerInfo)

This requests the server to go to that document in users/lilshake and add the key "age" and its value to what keys already exist.

the callback_AddToSimpleData() actually gives the confirmation of the patch.

Last updated