Skip to main content
Version: Streamsheets 3.0

MONGO.REPLACE

Replaces elements in a Mongo database. Only replaces one entry at a time.

Syntax

=MONGO.REPLACE(Connection, Collection, Query, Document, Upsert)

Arguments

NameTypeDescription
ConnectionConnectionReference to connection used for replacing. The database name is configured in the affiliated connection settings.
CollectionStringChoose an existing collection, where the item is stored.
QueryJSONDefine a query using a JSON cell range, which defines the document to be replaced.
DocumentJSONDefines the key-value pair(s) to be replacing the old entry.
UpsertBooleanOptional 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

TypeDescription
Booelan or ErrorTRUE, if no error.

Examples

FormulaResultComment
=MONGO.REPLACE(MongoConnection!,"TestCollection", JSON(A1:B4), JSON(C1:D4))
TRUEThe 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.