Skip to main content

MongoDB

This plugin discovers databases and collections from MongoDB instances.

Status: experimental

Example Configuration


host: "mongo-cluster.company.com"
port: 27017
user: "analytics_reader"
password: "mongo_pass_456"
auth_source: "admin"
tls: true
tags:
- "mongodb"
- "analytics"

Configuration

The following configuration options are available:

PropertyTypeRequiredDescription
connection_uristringfalseMongoDB connection URI (overrides host/port/user/password)
hoststringfalseMongoDB server hostname or IP address
portintfalseMongoDB server port (default: 27017)
userstringfalseUsername for authentication
passwordstringfalsePassword for authentication
auth_sourcestringfalseAuthentication database name
tlsboolfalseEnable TLS/SSL for connection
tls_insecureboolfalseSkip verification of server certificate
include_databasesboolfalseWhether to discover databases
include_collectionsboolfalseWhether to discover collections
include_viewsboolfalseWhether to include views
include_indexesboolfalseWhether to include index information
sample_schemaboolfalseSample documents to infer schema
sample_sizeintfalseNumber of documents to sample (default: 1000, -1 for entire collection)
use_random_samplingboolfalseUse random sampling for schema inference
database_filterplugin.FilterfalseFilter configuration for databases
collection_filterplugin.FilterfalseFilter configuration for collections
exclude_system_dbsboolfalseWhether to exclude system databases (admin, config, local)

Available Metadata

The following metadata fields are available:

FieldTypeDescription
backgroundboolWhether the index was built in the background
cappedboolWhether the collection is capped
collectionstringCollection name
createdstringCreation timestamp if available
data_types[]stringObserved data types
databasestringDatabase name
descriptionstringField description from validation schema if available
document_countint64Approximate document count
field_namestringField name
fieldsstringFields included in the index
frequencyfloat64Frequency of field occurrence in documents
hoststringMongoDB server hostname
index_countintNumber of indexes on collection
is_requiredboolWhether field appears in all documents
max_documentsint64Maximum document count for capped collections
max_sizeint64Maximum size for capped collections
namestringIndex name
object_typestringObject type (collection, view)
partialboolWhether the index is partial
partial_filterstringFilter expression for partial indexes
portintMongoDB server port
replicatedboolWhether collection is replicated
sample_valuesstringSample values from documents
shard_keystringShard key if collection is sharded
sharding_enabledboolWhether sharding is enabled
sizeint64Collection size in bytes
sparseboolWhether the index is sparse
storage_enginestringStorage engine used
ttlintTime-to-live in seconds if TTL index
typestringIndex type (e.g., single field, compound, text, geo)
uniqueboolWhether the index enforces uniqueness
validation_actionstringValidation action if schema validation is enabled
validation_levelstringValidation level if schema validation is enabled