For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

MongoDB

Configuration reference for the MongoDB metadata source: supported stages, source options, required roles, and troubleshooting.

MongoDB is supported as a metadata source. A spec.type: metadata pipeline introspects a MongoDB deployment and publishes source context, including databases, collections, inferred fields, and profiles, into the DataOS metadata catalog without copying any documents. Because MongoDB is schema-less, Nilus infers each collection's field structure by sampling documents.

For batch row movement out of MongoDB, see MongoDB (batch). For change data capture, see MongoDB (CDC). For the field-by-field authoring contract, see Understanding metadata pipeline config.

Metadata stages

service_type: mongodb supports metadata, profiler, and classification only.

Stage
Runs in
What it lands in the catalog

metadata

shallow, deep

Databases, collections, and the fields inferred from sampled documents (including nested documents and arrays).

profiler

deep

Per-field statistics computed from a document sample (value counts, null ratios, basic distributions) and collection-level document counts.

classification

deep

Auto-classification tags applied to fields from sampled values (PII heuristics).

lineage

Not applicable

Not supported for MongoDB.

usage

Not applicable

Not supported for MongoDB.

Because lineage and usage are not applicable, a shallow MongoDB pipeline effectively runs the metadata stage only, and a deep pipeline runs metadata + profiler + classification. mode is still required by the schema. query_log_duration and result_limit have no effect on MongoDB.

Asset hierarchy

The catalog models a MongoDB server as one database named default. Real Mongo databases appear one level down as schemas, and collections as tables. Nested documents are nested fields, and arrays are repeated fields.

Use schema_filter with the Mongo database name. A real Mongo database name does not match the catalog database, so database_filter is ineffective for this purpose.

Source options

Metadata pipelines accept only the customer-facing source.options keys below.

Option
Required
Used by stages
Description

service_type

Yes

all

Must be mongodb.

schema_filter

No

metadata, profiler, classification

Restrict by Mongo database name (the catalog schema level). Object with includes / excludes arrays of regex patterns.

table_filter

No

metadata, profiler, classification

Restrict by collection name. Same shape as schema_filter.

database_filter

No

Not applicable

Not useful on MongoDB. The catalog database is always default; names like appdb match nothing.

threads

No

profiler

Parallel worker count for the profiler. Raise it to cut runtime on large scopes.

query_log_duration and result_limit do not apply to MongoDB because it has no query-history surface. mode (shallow or deep) is a required spec field, not a source.options key.

Required permissions

Metadata extraction needs read access to the databases and collections in scope, plus the ability to enumerate the deployment:

  • read on each database in scope (or readAnyDatabase) is required for inventory, profiling, and classification, all of which sample documents.

  • clusterMonitor on admin lets Nilus list databases and read deployment topology.

Example grant for a dedicated metadata user:

To limit scope to specific databases, replace readAnyDatabase with a per-database read grant for each database in scope. clusterMonitor is still required so Nilus can enumerate databases.

Sample Nilus config

Direct URI (no depot)

Project credentials through spec.use.projection:

shallow mode runs the metadata stage only; deep mode additionally runs profiler and classification. Lineage and usage stages are never generated for MongoDB. For more ready-to-edit examples, see Metadata sample configs.

Behavior and capabilities

  • Connection: Use a MongoDB depot (dataos://<depot>?purpose=rw) or a direct mongodb://... URI with projected credentials. Because spec.type is metadata, Nilus adds the internal metadata+ routing prefix automatically. The URI accepts a comma-separated list of replica-set members in the host position. Pass databaseName and sslmode as query parameters. sslmode defaults to disable when omitted. Depot connections, and URIs without databaseName, still land under the default catalog database.

  • Filter on schema, not database: A database_filter matching a real Mongo database name leaves inventory unchanged. It can also make classification and profiler complete with no work. Use schema_filter with the Mongo database name.

  • Schema inference: MongoDB is schema-less, so field structure is inferred from a sample of documents per collection. Fields that appear only in unsampled documents may not be captured. Heterogeneous collections are represented by the shape observed in the sample.

  • Nested data: Nested documents and arrays are preserved as nested and repeated field structures in the catalog.

  • No lineage or usage: MongoDB exposes no query history or view definitions, so lineage and usage are not produced. Model relationships downstream if needed. Do not expect column-level lineage for document collections.

  • Scope discipline: Set schema_filter and table_filter in production. Exclude the admin, local, config, and system.* namespaces.

Troubleshooting

Symptom
Likely cause
Resolution

Authentication failed

Wrong credentials or missing read on the target database.

Verify the projected secret and grant read (or readAnyDatabase).

not authorized on admin to execute command { listDatabases }

The user lacks clusterMonitor.

Grant clusterMonitor on admin so Nilus can enumerate databases.

Collections appear with missing fields

The document sample did not include documents carrying those fields.

Expected for heterogeneous collections; increase the sample where supported, or accept the inferred shape.

classification / profiler completed with no tags or stats

database_filter named a Mongo database.

Use schema_filter with that name instead.

Lineage / usage empty

Not supported for MongoDB.

Expected. MongoDB has no query-history or view surface. Use metadata + profiler + classification.

TLS handshake errors

Server enforces TLS but the URI omits sslmode.

Add ?sslmode=require (or a stricter mode) to the URI.

Last updated

Was this helpful?