Skip to main content

About MongoDB Atlas

MongoDB Atlas is a fully managed cloud database service built on MongoDB — the most popular NoSQL document database. It provides a flexible, scalable, and developer-friendly platform for modern applications. Key features include:
  • Document Model: MongoDB stores data as flexible JSON-like documents, making it easy to model complex, hierarchical data structures without rigid schemas.
  • Multi-Cloud Deployment: Atlas runs on AWS, Azure, and Google Cloud, offering global clusters, automated failover, and cross-region replication for high availability.
  • Full-Text Search: Built-in Atlas Search powered by Apache Lucene enables rich text search capabilities directly on your MongoDB data without external search engines.
  • Aggregation Framework: MongoDB’s powerful aggregation pipeline supports complex data transformations, grouping, filtering, and analytics directly within the database.
  • Security & Compliance: Atlas provides encryption at rest and in transit, network isolation, role-based access control, and compliance with SOC 2, HIPAA, PCI DSS, and GDPR.
  • Scalability: From serverless instances for development to dedicated clusters handling millions of operations per second, Atlas scales with your needs.

Authentication

The MongoDB Atlas connector currently supports API Key authentication only in xpander.ai.

Supported method

  • Auth Method: API Key
  • Header Name: x-mongodb-uri
  • Header Value: your full MongoDB connection string
Example value:
mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/

MongoDB-side requirements

On the MongoDB side, use standard MongoDB username/password credentials in the connection string.

Configure in xpander.ai

  1. In xpander.ai, open Connectors.
  2. Select MongoDB Atlas and click Create new connection.
  3. Set Connection name.
  4. Set Connection access (for example, Personal).
  5. Select API Key as the authentication method.
  6. In the API Key section, choose type Custom.
  7. Set the custom header name to x-mongodb-uri.
  8. Paste your MongoDB connection string as the header value.
  9. Click Save.
MongoDB Atlas connection configuration

Integration of MongoDB Atlas into AI Agent

Once you’ve configured your MongoDB Atlas connector with the authentication option(s) described above, you can integrate it into your AI agent with xpander.ai:
  1. In your xpander.ai dashboard, go to the Agent Configuration tab and select Tools, then click Add Tools.
  2. Select Connectors.
  3. Choose MongoDB Atlas with the same connector name you configured in the previous section (e.g., xpander-mongodb).
  4. Select the available MongoDB operations that suit your use case.

Available Operations

The MongoDB Atlas connector provides the following operations: Discovery (Control Plane)
OperationDescription
List DatabasesReturns all databases accessible by the configured user
List CollectionsReturns all collection names in a specified database
List IndexesReturns all indexes defined on a collection
Get Collection StatsReturns document count, storage size, and index information
Sample Collection SchemaSamples documents to detect field names and types
Data Plane — Read
OperationDescription
Find DocumentsQuery with filter, projection, sort, limit, and skip
Find One DocumentReturn the first document matching a filter
Count DocumentsCount documents matching a filter
Get Distinct ValuesGet unique values for a specific field
Run Aggregation PipelineExecute MongoDB aggregation pipelines (match,match, group, sort,sort, lookup, etc.)
Data Plane — Write
OperationDescription
Insert One DocumentInsert a single document
Insert Many DocumentsBatch insert multiple documents
Update One DocumentUpdate the first matching document using update operators
Update Many DocumentsUpdate all matching documents
Replace One DocumentReplace an entire document
Delete One DocumentDelete the first matching document
Delete Many DocumentsDelete all matching documents

AI Agent MongoDB Atlas Prompt Library

Below are possible prompts or use cases you can try after integrating MongoDB Atlas into your xpander AI agent:
What databases are available and how many collections does each one have?
Show me the schema of the {collection_name} collection in {database_name}.
Find all documents in {collection_name} where {field} is greater than {value}, sorted by {sort_field} descending.
What are the top 10 {category_field} values by document count in {collection_name}?
Insert a new document into {collection_name} with the following fields: {field1}: {value1}, {field2}: {value2}.
Update all documents in {collection_name} where {condition_field} equals {value} — set {update_field} to {new_value}.
Run an aggregation on {collection_name}: group by {field}, calculate the average {numeric_field}, and sort by the result.
How many documents in {collection_name} were created in the last 30 days?