Skip to Content

MongoDB

MongoDB icon
Community

Tools to query and explore a MongoDB database

Author:Arcade
Version:0.4.0
Auth:No authentication required
6tools
6require secrets
PyPI VersionPython VersionsWheel StatusDownloadsLicense

Arcade's MongoDB toolkit provides tools to query and explore MongoDB instances. It enables schema sampling, collection discovery, filtered reads, counts, and aggregation pipelines for data exploration and analytics.

Capabilities

  • Discover databases/collections and sample documents to infer schema structure before querying.
  • Perform efficient reads with projection, sorting and complex filtering to limit payloads and improve performance.
  • Execute aggregation pipelines for transformations, joins, grouping and analytics workflows.
  • Follow operational best practices: always discover collections first, fetch collection schema before queries, use indexes and limit returned fields.

Secrets

  • password: MONGODB_CONNECTION_STRING — a connection string/credentials (e.g., mongodb+srv://user:password@cluster.example.com/db). Store securely and supply at runtime.

Available tools(6)

6 of 6
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. Use the <get_collection_schema> tool to load the schema if 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 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
Find documents in a MongoDB collection. ONLY use this tool if you have already loaded the schema of the collection you need to query. Use the <get_collection_schema> tool to load the schema if 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 important fields first. If you aren't sure, sort by '_id'. * 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
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 using the <discover_collections> tool.
1

Selected tools

No tools selected.

Click "Show all tools" to add tools.

Requirements

Select tools to see requirements

#

Mongodb.AggregateDocuments

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. Use the <get_collection_schema> tool to load the schema if 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

Parameters

ParameterTypeReq.Description
database_namestringRequiredThe database name to query
collection_namestringRequiredThe collection name to query
pipelinearray<string>RequiredMongoDB aggregation pipeline as a list of JSON strings, each representing a stage. Example: ['{"$match": {"status": "active"}}', '{"$group": {"_id": "$category", "count": {"$sum": 1}}}']
limitintegerOptionalThe maximum number of results to return from the aggregation. Default: 1000.

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Mongodb.CountDocuments

Count documents in a MongoDB collection matching the given filter.

Parameters

ParameterTypeReq.Description
database_namestringRequiredThe database name to query
collection_namestringRequiredThe collection name to query
filter_dictstringOptionalMongoDB filter/query as JSON string. Leave None for no filter (count all documents). Example: '{"status": "active"}'

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:integerNo description provided.
#

Mongodb.DiscoverCollections

Discover all the collections in the MongoDB database when the list of collections is not known. ALWAYS use this tool before any other tool that requires a collection name.

Parameters

ParameterTypeReq.Description
database_namestringRequiredThe database name to discover collections in

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Mongodb.DiscoverDatabases

Discover all the databases in the MongoDB instance.

Parameters

No parameters required.

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Mongodb.FindDocuments

Find documents in a MongoDB collection. ONLY use this tool if you have already loaded the schema of the collection you need to query. Use the <get_collection_schema> tool to load the schema if 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 important fields first. If you aren't sure, sort by '_id'. * 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).

Parameters

ParameterTypeReq.Description
database_namestringRequiredThe database name to query
collection_namestringRequiredThe collection name to query
filter_dictstringOptionalMongoDB filter/query as JSON string. Leave None for no filter (find all documents). Example: '{"status": "active", "age": {"$gte": 18}}'
projectionstringOptionalFields to include/exclude as JSON string. Use 1 to include, 0 to exclude. Example: '{"name": 1, "email": 1, "_id": 0}'. Leave None to include all fields.
sortarray<string>OptionalSort criteria as list of JSON strings, each containing 'field' and 'direction' keys. Use 1 for ascending, -1 for descending. Example: ['{"field": "name", "direction": 1}', '{"field": "created_at", "direction": -1}']
limitintegerOptionalThe maximum number of documents to return. Default: 1000.
skipintegerOptionalThe number of documents to skip. Default: 0.

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Mongodb.GetCollectionSchema

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 using the <discover_collections> tool.

Parameters

ParameterTypeReq.Description
database_namestringRequiredThe database name to get the collection schema of
collection_namestringRequiredThe collection to get the schema of
sample_sizeintegerOptionalThe number of documents to sample for schema discovery (default: 1000)

Requirements

Secrets:MONGODB_CONNECTION_STRING

Output

Type:jsonNo description provided.
Last updated on