MONGO.REPLACE
Replaces elements in a Mongo database. Only replaces one entry at a time.
Syntax
=MONGO.REPLACE(Connection, Collection, Query, Document, Upsert)
Arguments
| Name | Type | Description |
|---|---|---|
| Connection | Connection | Reference to connection used for replacing. The database name is configured in the affiliated connection settings. |
| Collection | String | Choose an existing collection, where the item is stored. |
| Query | JSON | Define a query using a JSON cell range, which defines the document to be replaced. |
| Document | JSON | Defines the key-value pair(s) to be replacing the old entry. |
| Upsert | Boolean | Optional Parameter to define, if a new document will be created when the query can not find a document to be replaced. Default value: FALSE |
Return
| Type | Description |
|---|---|
| Booelan or Error | TRUE, if no error. |
Examples
| Formula | Result | Comment |
|---|---|---|
| TRUE | The Query looks for a document in the collection which matches the A1:B4 key-value pairs. The found document will be deleted and the new document takes its place. If nothing is found to be replaced, no action will occur. |