> For the complete documentation index, see [llms.txt](https://rocket-networking.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rocket-networking.gitbook.io/docs/rocket-networking-code/database-functions/setsimpledata.md).

# 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)
```

| Argument         | Description                                                                                                                 |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `collectionName` | <p>The name of the collection in the root of your database where you want to edit a document.<br>This must be a String.</p> |
| `documentName`   | <p>The name of the document you are creating/updating.<br>This must be a String.</p>                                        |
| `mapStruct`      | <p>The data you want to store at this location.<br>This must be a Struct of key-value pairs of your data.</p>               |

#### Returns

```
Number  // a positive integer you can note down
```

## Example Implementation

<pre><code><strong>var playerInfo = {
</strong><strong>    ip: "155.34.22.11",
</strong><strong>    location : "Ontario"
</strong><strong>}
</strong><strong>var name = get_string("Whats your name?","Name");  ///user replies lilshake
</strong><strong>var writeId = SetSimpleData("users", "name", playerInfo)
</strong></code></pre>

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

the **callback\_SetSimpleData()** actually gives the confirmation of the write.
