> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datazone.co/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB

> MongoDB is a popular NoSQL database that stores data in flexible, JSON-like documents.

# Overview

MongoDB is a document-oriented NoSQL database that provides high performance, high availability, and easy scalability. Datazone provides native integration with MongoDB to read data directly from your collections.

## Connection Parameters

Set on the source when you create it. Names match the API and CLI payload.

<ParamField path="name" type="string" required>
  **Name** — a unique identifier for your MongoDB source.
</ParamField>

<ParamField path="host" type="string" required>
  **Host** — hostname or IP address of your MongoDB server. You may also supply a full connection string beginning with `mongodb://` or `mongodb+srv://`, in which case it is used verbatim and `port`, `user`, and `password` are ignored. Use this form for replica sets, Atlas clusters, and any connection needing extra options.
</ParamField>

<ParamField path="port" type="string" required>
  **Port** — port the MongoDB server listens on. Typically `27017`.
</ParamField>

<ParamField path="database_name" type="string" required>
  **Database Name** — the database holding the collections you want to extract.
</ParamField>

<ParamField path="user" type="string" required>
  **User** — username with read permission on the database.
</ParamField>

<ParamField path="password" type="string" required>
  **Password** — password for the specified user. Stored encrypted.
</ParamField>

## Extract Parameters

Set per extract, in `source_parameters`. See [Shared Extract Parameters](/reference/sources/overview#shared-extract-parameters) for `mode`, `replication_key`, and `schema_mapping`.

<ParamField path="collection_name" type="string" required>
  **Collection Name** — the collection to extract, within the source's `database_name`.
</ParamField>

<ParamField path="batch_size" type="integer" default="10000">
  Documents fetched and written per batch. Lower than the relational default because documents are typically wider than rows.
</ParamField>

<ParamField path="infer_schema_max_docs" type="integer" default="50">
  Number of documents sampled to infer the schema. Raise it when a collection is heterogeneous and fields present in only a few documents are being missed.
</ParamField>

<ParamField path="cast_to_string" type="boolean" default="true">
  Cast values to string rather than inferring narrower types. Keeps the schema stable across documents whose field types disagree.
</ParamField>

<ParamField path="select_clause" type="string" default="*">
  Fields to read, as a comma-separated list.
</ParamField>

<ParamField path="filter_clause" type="string">
  Row filter applied to the documents read.
</ParamField>

## Required Permissions

The MongoDB user account needs the following permissions:

* `find` - For reading documents from collections
* `listCollections` - For listing available collections
* `listIndexes` - For accessing collection indexes
* `read` - For reading data from the database

## Limitations

Be aware of the following limitations when working with MongoDB sources:

* Complex MongoDB data types may be converted to standard formats
* Individual document size limits apply based on your MongoDB configuration
* The schema is inferred from a sample of documents, not from the whole collection

## Next Steps

After configuring your MongoDB source:

1. Create extracts to specify which collections to ingest
2. Configure scheduling for recurring extracts
3. Integrate the source into your data pipelines

For more information about working with extracts and pipelines, refer to their respective documentation sections.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.