src/postgres/third-party-extensions/documentdb/docs/v1/gateway.md
The DocumentDB Gateway acts as a protocol translation layer between MongoDB clients and a PostgreSQL backend. It interprets MongoDB wire protocol, maps commands to PostgreSQL operations, and manages session handling, transactions, cursor-based paging, and TLS termination.
The gateway converts MongoDB operations into PostgreSQL equivalents.
Example: insertMany → PostgreSQL BATCH INSERT.
createUser, updateUser, dropUser are mapped to PostgreSQL.readAnyDatabase, readWriteAnyDatabase.transaction_number.TransactionStore:
Started, Committed, Aborted.BEGIN, COMMIT, ROLLBACK.LIMIT/OFFSET.cursorId and first result batch.getMore fetches subsequent pages.CursorStore manages cursor lifecycle and cleanup.RecoveryTokenTo get started with the DocumentDB Gateway, follow these steps:
docker build . -f .github/containers/Build-Ubuntu/Dockerfile_gateway -t <image-tag>
docker run -dt -p 10260:10260 -e USERNAME=<username> -e PASSWORD=<password> <image-tag>
mongosh localhost:10260 -u <username> -p <password> \
--authenticationMechanism SCRAM-SHA-256 \
--tls \
--tlsAllowInvalidCertificates