Skip to Content
ResourcesIntegrationsDatabasesMongoDB

MongoDB

MongoDB icon
Arcade Optimized

Tools to query and explore a MongoDB database

Author:Arcade
Version:2.0.1
Auth:No authentication required
6tools
6require secrets

MongoDB Toolkit

Provides tools for querying and exploring a MongoDB database from Arcade agents. Enables schema discovery, document retrieval, aggregation pipelines, and collection/database enumeration.

Capabilities

  • Schema & structure discovery: List all databases, enumerate collections within a database, and sample documents to infer field names and data types for schema-less collections.
  • Document querying: Find documents with filtering, projection, sorting, and MongoDB query operators ($gte, $in, $regex, etc.).
  • Aggregation pipelines: Execute multi-stage pipelines ($match, $group, $project, $sort, $lookup, and more) for complex data processing and cross-collection joins.
  • Document counting: Count documents matching an arbitrary filter without fetching full documents.

Secrets

MONGODB_CONNECTION_STRING — The full MongoDB connection URI used to authenticate and connect to the MongoDB instance. This string encodes the protocol, credentials (username and password), host(s), port, and database name, for example: mongodb+srv://user:password@cluster.example.mongodb.net/mydb. Obtain it from your MongoDB provider:

  • MongoDB Atlas: Navigate to your cluster in the Atlas dashboard, click Connect, choose Drivers, and copy the connection string. Replace the <password> placeholder with the actual database user password. The user must have at least read permissions on the target database (or read/write if mutations are needed). Create database users under Database Access in the Atlas UI.
  • Self-hosted MongoDB: Construct the URI manually using the host, port, and credentials configured in your mongod instance or mongos router. Refer to the MongoDB connection string documentation for syntax details.

For storing secrets in Arcade, see the Arcade secrets guide and manage them at https://api.arcade.dev/dashboard/auth/secrets.

Available tools(6)

6 of 6 tools
Operations
Behavior
Tool nameDescriptionSecrets
Execute a MongoDB aggregation pipeline on a collection. ONLY use this tool if you have already loaded the schema of the collection you need to query. Load the collection's schema first if it is not already known. Returns a list of JSON strings, where each string represents a result document from the aggregation (tools cannot return complex types). Aggregation pipelines allow for complex data processing including: * $match - filter documents * $group - group documents and perform calculations * $project - reshape documents * $sort - sort documents * $limit - limit results * $lookup - join with other collections * And many more stages
1
Count documents in a MongoDB collection matching the given filter.
1
Discover all the collections in the MongoDB database. Use when the list of collections is not known. ALWAYS use this tool before any other tool that requires a collection name.
1
Discover all the databases in the MongoDB instance.
1
Get the schema/structure of a MongoDB collection by sampling documents. Since MongoDB is schema-less, this tool samples a configurable number of documents to infer the schema structure and data types. This tool should ALWAYS be used before executing any query. All collections in the query must be discovered first by listing the database's collections.
1
Find documents in a MongoDB collection. ONLY use this tool if you have already loaded the schema of the collection you need to query. Load the collection's schema first if it is not already known. Returns a list of JSON strings, where each string represents a document from the collection (tools cannot return complex types). When running queries, follow these rules which will help avoid errors: * Always specify projection to limit fields returned if you don't need all data. * Always sort your results by the most relevant fields first. Use '_id' if you're unsure. * Use appropriate MongoDB query operators for complex filtering ($gte, $lte, $in, $regex, etc.). * Be mindful of case sensitivity when querying string fields. * Use indexes when possible (typically on _id and commonly queried fields).
1
Last updated on