MongoDB
App · Databases · 4 actions
Find, insert, update, and delete documents in your MongoDB collections.
Actions
| Action | What it does |
|---|---|
| Delete documents | Delete documents from a MongoDB collection. |
| Find documents | Find documents in a MongoDB collection, optionally filtered and limited. |
| Insert documents | Insert one or more documents into a MongoDB collection. |
| Update documents | Update documents in a MongoDB collection. |
Delete documents
Delete documents from a MongoDB collection.
Inputs
- Database
databasetextRequired - The database that contains the collection.
- Collection
collectiontextRequired - Collection containing the documents to delete.
- Filter
filterobjectRequired - A MongoDB query object identifying which documents to delete, e.g. {"_id": "64b0000000000000000000aa"}. Must be non-empty; to delete every document deliberately, use {"_id": {"$exists": true}}.
- Delete all matches
manytrue/false - Set to true to delete every matching document, or false to delete only the first match.Default:
false.
Outputs
deleted_countnumber- Number of deleted documents.
Example output
{
"deleted_count": 1
}Find documents
Find documents in a MongoDB collection, optionally filtered and limited.
Inputs
- Database
databasetextRequired - The database that contains the collection.
- Collection
collectiontextRequired - The collection to read from.
- Filter
filterobject - A MongoDB query object of the fields and values documents must match, e.g. {"status": "active"}. Leave blank to return every document. Query operators such as $gt, $in and $regex are supported.
- Limit
limitnumber - The maximum number of documents to return.At least 1.
Outputs
countnumber- Number of documents returned.
documentslist- The matching documents. Each document's _id is returned as a string.
Example output
{
"count": 1,
"documents": [
{
"_id": "64b0000000000000000000aa",
"active": true,
"name": "Ada"
}
]
}Insert documents
Insert one or more documents into a MongoDB collection.
Inputs
- Database
databasetextRequired - The database that contains the collection.
- Collection
collectiontextRequired - The collection to insert into. Pick an existing collection, or reference a name from an earlier step to create one on the fly (MongoDB creates the collection automatically on first insert).
- Documents
documentslistRequired - The documents to insert. Each item is an object of field names and values. Omit _id to let MongoDB generate one.
Outputs
inserted_countnumber- Number of documents inserted.
inserted_idslist- The _id of each inserted document, as strings.
Example output
{
"inserted_count": 1,
"inserted_ids": [
"64b0000000000000000000bb"
]
}Update documents
Update documents in a MongoDB collection.
Inputs
- Database
databasetextRequired - The database that contains the collection.
- Collection
collectiontextRequired - Collection containing the documents to update.
- Filter
filterobjectRequired - A MongoDB query object identifying which documents to update, e.g. {"email": "ada@example.com"}. Must be non-empty; to update every document deliberately, use {"_id": {"$exists": true}}.
- Updates
updatesobjectRequired - The fields and new values to save on each matching document (applied with MongoDB's $set), e.g. {"status": "archived"}.
- Update all matches
manytrue/false - Set to true to update every matching document, or false to update only the first match.Default:
false.
Outputs
matched_countnumber- Number of matched documents.
modified_countnumber- Number of modified documents.
Example output
{
"matched_count": 1,
"modified_count": 1
}