InsertOne InsertOne

type: "io.kestra.plugin.mongodb.InsertOne"

Insert one document

# Examples

Insert a document with a map

id: "insert_one"
type: "io.kestra.plugin.mongodb.InsertOne"
connection:
  uri: "mongodb://root:example@localhost:27017/?authSource=admin"
database: "my_database"
collection: "my_collection"
document:
  _id:
    $oid: 60930c39a982931c20ef6cd6
  name: "John Doe"
  city: "Paris"

Insert a document from a json string

id: "insert_one"
type: "io.kestra.plugin.mongodb.InsertOne"
connection:
  uri: "mongodb://root:example@localhost:27017/?authSource=admin"
database: "my_database"
collection: "my_collection"
document: "{{ outputs.task_id.data | json }}"

# Properties

# collection

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The mongodb collection.

# connection

The connection properties.

# database

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The mongodb database.

# document

  • Type: ====
  • Dynamic: ✔️
  • Required: ✔️

The mongodb document

Can be a bson string, or a map

# Outputs

# insertedId

  • Type: string

The inserted Id

# 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 (opens new window) like mongodb://mongodb0.example.com:27017