Skip to main content

MongoDB Component

Interact with documents in a MongoDB database

Component key: mongo

Description

MongoDB is a NoSQL database program that uses JSON-like documents with optional schemas. This component allows you to create, read, update, and delete documents inside a MongoDB collection.

Connections

Mongo Connection

Create a new MongoDB connection and enter the connection string for your MongoDB server.

Actions

Convert Object ID

The Object ID is a unique identifier for a document in a MongoDB collection. This action takes either a string ID or Object ID object, and returns both the ObjectID '_id' and stringified ID versions of the ID which can be used in subsequent actions. | key: convertObjectId


Delete Many

Remove documents from a collection that match a query. | key: deleteMany

Output Example Payload

{
"data": {
"acknowledged": true,
"deletedCount": 1
}
}

Find All

Retrieve all documents in a collection that match a query. | key: findAll

Output Example Payload

{
"data": [
{
"_id": "610ae111774d8aaef3b5d2eb",
"id": "610ae111774d8aaef3b5d2eb",
"exampleKey": "exampleValue"
}
]
}

Find One

Retrieve one document in a collection that match a query. If no document is found, an error is thrown. | key: findOne

Output Example Payload

{
"data": {
"_id": "610ae111774d8aaef3b5d2eb",
"id": "610ae111774d8aaef3b5d2eb",
"exampleKey": "exampleValue"
}
}

Insert Many

Insert new documents into a collection | key: insertMany

Output Example Payload

{
"data": {
"acknowledged": true,
"insertedCount": 3,
"insertedIds": {}
}
}

Insert One

Insert a new document into a collection | key: insertOne

Output Example Payload

{
"data": {
"acknowledged": true,
"insertedId": "610ae111774d8aaef3b5d2eb"
}
}

Raw Request

Execute database commands directly. Does not use collection from connection. | key: rawRequest


Update One

Update a single document in a collection | key: updateOne

Output Example Payload

{
"data": {
"acknowledged": true,
"modifiedCount": 1,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 1
}
}