Add PyMongo + Document DB Playground - #3
Merged
hossain-rayhan merged 1 commit intoJul 30, 2026
Conversation
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new PyMongo playground under
playgrounds/pymongo/, following the same structure as the existing Mongoose and Beanie playgrounds. Unlike those ODM-based demos, this one exercises DocumentDB at the raw driver level (collections + BSON documents, no ODM), paired with Flask as the synchronous web framework.What's Included
app/main.py):/health,POST/GET /books,GET/PATCH/DELETE /books/{id},GET /stats/genres.app/db.py):MongoClientwith DocumentDB's required options (directConnection,tls,tlsAllowInvalidCertificates) and automaticreplicaSet=rs0stripping.app/models/book.py): collection name, index specs (nocollation), document builder + JSON serializer.app/pymongo_crud_test.py): 16 steps covering connect, index creation, insert, query, update, aggregation, unique-index enforcement, delete, and vector search (cosmosSearchvector-ivfindex +$vectorSearchnearest-neighbor query).scripts/):lib.sh,start-documentdb.sh,stop-documentdb.sh,run-test.sh,run-app.sh— auto-start DocumentDB if needed,KEEP_DBsupport, shared credentials aligned with the other playgrounds.Repo-Level Changes
README.md(playground table, getting-started commands, repository layout)..gitignorealready covers the Python artifacts (.venv/,__pycache__/,*.pyc) — no change needed.Validation
GET /health,POST /books(201),GET /books/{id},PATCH /books/{id},GET /books,GET /stats/genres,DELETE /books/{id}(204).bash -nsyntax checks.Notes
.venv,__pycache__removed); DocumentDB container stopped after verification.