Skip to main content
Version: Streamsheets 2.4

MONGO.REPLACE

Replaces elements in a Mongo database. You can use the Function Wizard for this function. Only replaces one entry at a time.

Syntax

=MONGO.REPLACE(Producer, Collection, Query, Document[, Upsert])

Arguments

NameDescription
ProducerProducer to use for counting. The database name is configured in the affiliated Connector.
CollectionChoose an existing collection, where the item is stored.
QueryDefine a query using a JSON cell range, which defines the document to be replaced.
DocumentDefines the key-value pair(s) to be replacing the old entry.
UpsertOptional Parameter to define, if a new document will be created when the query can not find a document to be replaced. Default = FALSE

Return Value

TRUE, if no error.

Examples

FunctionResultComment
=MONGO.REPLACE(|Producer, "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.