Getting Started
Recommended flow
Install and verify DocumentDB
Choose one install path first. After DocumentDB is running, verify the connection with mongosh before moving to a driver quick start.
Choose an install path
Use Docker for the fastest local setup, or Linux packages for a persistent host installation.
Run locally with Docker
Best for evaluation, local development, and quick testing.
Install from Linux packages
Use the repository-backed package flow when you want a persistent server install. Generate the exact apt or rpm command with the Package Finder.
Recommended: verify with mongosh
This is the fastest shared validation path after either install option because it confirms authentication, TLS, and a working endpoint before you add editor or driver setup. If you already know your target workflow, you can skip this and continue directly with VS Code or a driver quick start.
Or go directly to Visual Studio Code Quick Start, Node.js Quick Start or Python Quick Start.
Getting Started
DocumentDB is an open-source document database platform built on PostgreSQL. It offers developers a fully permissive, open-source platform for document data stores.
What is DocumentDB?
DocumentDB provides a NoSQL datastore implemented using PostgreSQL, giving developers complete visibility into the architecture and implementation of the engine. It's designed to offer:
- Full compatibility with the MongoDB wire protocol through the
pg_documentdb_gwgateway - Public document CRUD and management APIs through the
pg_documentdbextension - Native BSON document support via the
pg_documentdb_corePostgreSQL extension - Advanced indexing capabilities including single field, multi-key, compound, text, geospatial, and vector indexes
- Vector search functionality powered by the
pgvectorPostgreSQL extension - Enterprise-grade security with SCRAM authentication
- Full PostgreSQL compatibility for advanced SQL operations
Key Features
- PostgreSQL Foundation: Built on the powerful PostgreSQL engine, allowing you to leverage both document and relational capabilities
- Open Source: Released under the MIT license with no restrictions on usage, modification, or distribution
- Document Database Standard: First implementation towards creating an open standard for document databases, similar to ANSI SQL for relational databases
- Cloud Ready: Supports multi-cloud deployments across major cloud providers with native integration in Azure Cosmos DB
- Developer Friendly: Rich ecosystem of tools and extensions, including VS Code integration and MongoDB compatibility
Architecture Components
DocumentDB consists of three primary components:
- pg_documentdb_core: Core PostgreSQL extension that provides native BSON storage, field access, and indexing primitives.
- pg_documentdb: Public API surface that implements document commands, CRUD operations, query execution, and index management.
- pg_documentdb_gw: Gateway that translates MongoDB wire protocol requests into PostgreSQL operations and handles authentication, sessions, and TLS.
Together, these components let you use DocumentDB through MongoDB-compatible tools and drivers while still benefiting from PostgreSQL internals.
Common Use Cases
- Modern Web Applications: Store and query JSON documents with MongoDB compatibility
- AI/ML Applications: Leverage vector search for similarity matching and embeddings
- Hybrid Data Models: Combine document and relational data in the same database
- Migration Path: Easy transition from existing MongoDB workloads
- Local Development: Full-featured local instance for development and testing
Start here
If you're new to DocumentDB, use this order:
- Docker Quick Start - Fastest local install for evaluation and development
- Mongo Shell Quick Start - Verify connectivity, authentication, and your first queries
- Node.js Quick Start or Python Quick Start - Connect from an application driver
- Linux Packages Quick Start or the Package Finder - Use this when you need a persistent Linux installation instead of Docker
If you prefer an editor-first workflow, start with the Visual Studio Code Quick Start.
Verify your setup
Before moving on to application code, confirm that DocumentDB is reachable and you can run a simple query.
docker ps --filter "name=documentdb"
mongosh localhost:10260 \
-u <YOUR_USERNAME> \
-p <YOUR_PASSWORD> \
--authenticationMechanism SCRAM-SHA-256 \
--tls \
--tlsAllowInvalidCertificatesThen run:
db.runCommand({ ping: 1 })For a fuller walkthrough, use the Mongo Shell Quick Start. Driver-based examples are available in the Node.js Quick Start and Python Quick Start.
Troubleshooting and debugging
If setup does not work on the first try:
- Confirm the container is running and port
10260is published withdocker ps. - Inspect startup, authentication, and TLS errors with
docker logs documentdb. - If you want certificate validation instead of
tlsAllowInvalidCertificates=true, follow the certificate steps in DocumentDB Local. - For more verbose local diagnostics, restart DocumentDB Local with
--log-level debug; the available runtime options are documented in DocumentDB Local. - If you are installing on a host instead of Docker, use Linux Packages Quick Start or the Package Finder to get the correct apt or rpm flow.
Explore key features
Once you can connect successfully, continue with these guides:
- API Reference - MongoDB command and operator coverage
- Postgres Extension API - PostgreSQL-side functions, types, and operators
- DocumentDB Local - Local runtime options, sample data, certificates, and feature notes
- Architecture under the hood - How the core, extension, and gateway fit together
- Samples Gallery - End-to-end examples you can adapt for your own apps
Community and Support
- Discord Community: Join our Discord server for:
- Community syncs and office hours
- Real-time technical support
- Migration assistance
- Best practices sharing
- GitHub Repository: documentdb/documentdb
- Documentation: Comprehensive guides and API references
- Issue Tracking: Report bugs and request features on GitHub
Next Steps
After you finish the initial setup:
- Continue with the Mongo Shell Quick Start, Node.js Quick Start, or Python Quick Start
- Explore the API Reference for detailed command and operator documentation
- Join our community to get support and contribute
