update
Update or replace one or many documents in a MongoDB collection.
Update or replace one or many documents in a MongoDB collection.
Update or replace one or many documents in a MongoDB collection.
type: "io.kestra.plugin.mongodb.update"Examples
Replace a document.
id: mongodb_update
namespace: company.team
tasks:
- id: update
type: io.kestra.plugin.mongodb.Update
connection:
uri: "mongodb://root:example@localhost:27017/?authSource=admin"
database: "my_database"
collection: "my_collection"
operation: "REPLACE_ONE"
document:
_id:
$oid: 60930c39a982931c20ef6cd6
name: "John Doe"
city: "Paris"
filter:
_id:
$oid: 60930c39a982931c20ef6cd6
Update a document.
id: mongodb_update
namespace: company.team
tasks:
- id: update
type: io.kestra.plugin.mongodb.Update
connection:
uri: "mongodb://root:example@localhost:27017/?authSource=admin"
database: "my_database"
collection: "my_collection"
filter:
_id:
$oid: 60930c39a982931c20ef6cd6
document: "{"$set": { "tags": ["blue", "green", "red"]}}"
Properties
collection*Requiredstring
MongoDB collection.
connection*RequiredNon-dynamic
MongoDB connection properties.
io.kestra.plugin.mongodb.MongoDbConnection
Connection string to MongoDB server
URL format like mongodb://mongodb0.example.com: 27017
database*Requiredstring
MongoDB database.
document*Requiredobject
MongoDB document
filter*Requiredobject
MongoDB BSON filter
Can be a BSON string or a map.
operationstring
UPDATE_ONEREPLACE_ONEUPDATE_ONEUPDATE_MANYOperation to use
Outputs
matchedCountinteger
0The number of documents matched by the query
modifiedCountinteger
The number of documents modified by the update
upsertedIdstring
The upserted ID
Will be null for replace operation.
wasAcknowledgedboolean
Whether the write was acknowledged
Metrics
updated.countcounter
countNumber of documents updated in MongoDB