MongoDB

App · Databases · 4 actions

Find, insert, update, and delete documents in your MongoDB collections.

Actions

ActionWhat it does
Delete documentsDelete documents from a MongoDB collection.
Find documentsFind documents in a MongoDB collection, optionally filtered and limited.
Insert documentsInsert one or more documents into a MongoDB collection.
Update documentsUpdate documents in a MongoDB collection.

Delete documents

Delete documents from a MongoDB collection.

Inputs

DatabasedatabasetextRequired
The database that contains the collection.
CollectioncollectiontextRequired
Collection containing the documents to delete.
FilterfilterobjectRequired
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 matchesmanytrue/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

DatabasedatabasetextRequired
The database that contains the collection.
CollectioncollectiontextRequired
The collection to read from.
Filterfilterobject
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.
Limitlimitnumber
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

DatabasedatabasetextRequired
The database that contains the collection.
CollectioncollectiontextRequired
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).
DocumentsdocumentslistRequired
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

DatabasedatabasetextRequired
The database that contains the collection.
CollectioncollectiontextRequired
Collection containing the documents to update.
FilterfilterobjectRequired
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}}.
UpdatesupdatesobjectRequired
The fields and new values to save on each matching document (applied with MongoDB's $set), e.g. {"status": "archived"}.
Update all matchesmanytrue/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
}

On this page