MongoDB assets app
The MongoDB assets app crawls MongoDB Atlas databases and collections and publishes
them to Atlan. Build it with the MongodbAtlas builder.
Creating an app creates a new connection
Each create mints a new connection and new assets. To re-crawl, re-run the existing workflow (see Re-run an existing app).
Basic authentication
- Python
MongoDB crawling with basic auth
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.apps import MongodbAtlas
client = AtlanClient()
response = (
MongodbAtlas(client)
.basic( # (1)
username="atlan_user", # (2)
password="••••••", # (3)
native_host="demo-cluster.m1fmuci.mongodb.net", # (4)
default_database="my_db", # (5)
authsource="admin", # (6)
ssl="true", # (7)
host="atlas-sql-....a.query.mongodb.net", # (8)
)
.connection(
name="production-mongodb",
admin_roles=[client.role_cache.get_id_for_name("$admin")],
)
.include_databases("analytics,sales") # (9)
.run(name="mongodb-prod")
)
print(response.slug, response.run_id)
- Step 1—Credential. Username/password auth; the secret is vaulted.
- Required. Username.
- Required. Password.
- Required. The MongoDB native host (the cluster host).
- Required. The default database.
- Required. The authentication database (for example
admin). - Required. Whether to use SSL (
"true"/"false"). - Required. The Atlas SQL host. The port (
port=) is optional. Advanced: passconnection_string=...to override the individual fields. - Step 3—Metadata. Comma-separated database name patterns (regex).
Configuration options
All metadata options are optional:
- Python
MongoDB metadata configuration
(
MongodbAtlas(client)
.basic(username="atlan_user", password="••••••", native_host="...",
default_database="my_db", authsource="admin", ssl="true", host="...")
.connection(name="production-mongodb", admin_roles=[...])
.include_databases("analytics,sales") # (1)
.exclude_databases("tmp.*") # (2)
.run(name="mongodb-prod")
)
- Comma-separated database name patterns (regex) to include.
- Comma-separated database name patterns (regex) to exclude—wins over include.