Update
yaml
type: "io.kestra.plugin.mongodb.Update"
Update or Replace one or many documents
Examples
Replace a document
yaml
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
yaml
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
- Type: string
- Dynamic: ✔️
- Required: ✔️
The mongodb collection.
connection
- Type: MongoDbConnection
- Dynamic: ❓
- Required: ✔️
The connection properties.
database
- Type: string
- Dynamic: ✔️
- Required: ✔️
The mongodb database.
document
- Type: object
- Dynamic: ✔️
- Required: ✔️
The mongodb document
Can be a bson string, or a map
filter
- Type: object
- Dynamic: ✔️
- Required: ✔️
The mongodb bson filter
Can be a bson string, or a map
operation
- Type: string
- Dynamic: ❌
- Required: ❌
- Default:
UPDATE_ONE
- Possible Values:
REPLACE_ONE
UPDATE_ONE
UPDATE_MANY
Operation to use
Outputs
matchedCount
- Type: integer
- Default:
0
The number of documents matched by the query.
modifiedCount
- Type: integer
The number of documents modified by the update.
upsertedId
- Type: string
The upserted Id
Will be null if replace
operation
wasAcknowledged
- Type: boolean
true if the write was acknowledged.
Definitions
MongoDbConnection
uri
- Type: string
- Dynamic: ✔️
- Required: ✔️
- Min length:
1
Connection string to mongodb server
url format like mongodb://mongodb0.example.com:27017