Replace¶
Replace one document in the database.
Documentation¶
Replace a single document from the database matching Filter. If there are multiple matches, only the first match will be replaced.
What to replace with is specified using Replacement, which should be a complete replacement document. When upsert is active and no document matches Filter, a new document of the Replacement will be created.
Filter and Replacement can be specified either as part of the configuration or using opt-in json-ports.
See https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne/ for more details.
For info on how to input data to MongoDB, see MongoDB data format.
This node can output a write operation, see Output write operation.
Definition¶
Input ports¶
- mongodb mongodb
MongoDB
- filter 0 - 1, json
Filter
- replacement 0 - 1, json
Replacement
Output ports¶
- mongodb 0 - 1, mongodb
MongoDB
- replace_result 0 - 1, json
Replace result
- write_operation 0 - 1, json
Write operation. Output write operation instead of performing the operation directly. The write operation can be used as an element in a bulk write input list
Configuration¶
- Filter (filter)
Filter as json.
- Replacement (replacement)
Replacement as json.
- Upsert (upsert)
If True, perform an insert if no documents match the filter.
Examples¶
Implementation¶
- class node_mongodb.MongoDBReplace[source]