WorkOS Docs Homepage
Events
API referenceDashboardSign In
Event typesEvent typesData syncingOverviewOverviewSyncing with events APISyncing with events APISyncing with webhooksSyncing with webhooksData reconciliationData reconciliation
Syncing to external databasesSyncing to external databases
PostgresPostgresMySQLMySQLNeonNeonPlanetScalePlanetScaleMongoDB AtlasMongoDB AtlasClickHouse CloudClickHouse CloudMonitoring and OperationsMonitoring and Operations
ObservabilityStreaming to DatadogStreaming to Datadog
API Reference
API Reference
Integrations
Integrations
Migrate to WorkOS
Migrate to WorkOS
SDKs
SDKs

MongoDB Atlas

Mirror your WorkOS data into MongoDB Atlas from your own host.

On this page

  • Introduction
  • Prepare the cluster
  • Run from your own host
  • Query the mirror

Introduction

MongoDB Atlas is MongoDB’s hosted database service. The sync engine uses the @workos/sync-mongodb destination to mirror WorkOS objects into collections you can query alongside your application data.

The MongoDB Atlas integration guide in the sync engine repository covers cluster selection, database users, network access, connection strings, TLS, and deployment.

Prepare the cluster

Give the sync’s database user readWrite on the mirror’s database. Add dbAdmin on that database only if you need init --repair. The sync does not need the broader Atlas admin role; see Database user for details.

Allow the sync host through Atlas’s network access controls before connecting. See Network access for IP access lists and private networking considerations.

Run from your own host

Use the Atlas connection string as DATABASE_URL. The mongodb+srv:// form enables TLS and discovers the cluster through DNS. The mirror defaults to the workos database when the connection string does not name one; see Choose a connection for connection formats and database selection.

Follow Run the sync from your own host to initialize the mirror, backfill existing data, and start polling for changes. You can run the sync as a command, container, or library. The @workos/sync-mongodb README is the reference for configuration and operations.

Query the mirror

Collections such as workos_users keep the WorkOS payload under _raw. Their workos_<name>_live views exclude deleted objects. Use these views for current-state queries, and include _env when filtering or joining data from multiple WorkOS environments.

See Query it for Atlas Data Explorer, mongosh, and Compass, and the package’s query examples for joins and indexes.

ClickHouse Cloud Keep WorkOS sign-in history and mirror data in ClickHouse Cloud from your own host
Up next
© WorkOS, Inc.
FeaturesAuthKitSingle Sign-OnDirectory SyncAdmin PortalFine-Grained Authorization
DevelopersDocumentationChangelogAPI Status
ResourcesBlogPodcastPricingSecuritySupport
CompanyAboutCustomersCareersLegalPrivacy
© WorkOS, Inc.