SetSimpleData()

Description

This function creates or overwrites a document in the database. If the collection does not exist, the collection will be created. If the document does not exist, it will be created.

Syntax

SetSimpleData(collectionName, documentName, mapStruct)
ArgumentDescription

collectionName

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

documentName

The name of the document you are creating/updating. This must be a String.

mapStruct

The data you want to store at 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 = {
    ip: "155.34.22.11",
    location : "Ontario"
}
var name = get_string("Whats your name?","Name");  ///user replies lilshake
var writeId = SetSimpleData("users", "name", playerInfo)

This requests the server to create this struct as a document with name "lilshake"

the callback_SetSimpleData() actually gives the confirmation of the write.

Last updated