AddToSimpleData()

This page was fixed by @LordSesshomaru on Discord!

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)
ArgumentDescription

collectionName

The name of the collection in the root of your database where you want to append to a document. This must be a String.

documentName

The name of the document you are appending This must be a String.

mapStruct

The data you want to append toat this location. This must be a Struct of key-value pairs of your data.

Returns

Number  // a positive integer you can note down

Example Implementation

var playerInfo = {
    age : 21
}

AddToSimpleData("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