Add Spring Data + Document DB Playground - #6
Open
hossain-rayhan wants to merge 1 commit into
Open
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.
Add Spring Data MongoDB playground (Java)
Summary
Adds a fifth playground —
spring-data-mongodb— demonstrating Spring Boot + Spring Data MongoDB (Java) against a local DocumentDB emulator. This extends the repository into the JVM ecosystem, complementing the existing Node.js (Mongoose / native driver) and Python (Beanie / PyMongo) playgrounds. It follows the exact structure and conventions of the existing playgrounds.What's included
scripts/) mirroring the other playgrounds —lib.sh,start-documentdb.sh,stop-documentdb.sh,run-app.sh,run-test.sh— adapted to a Maven/JDK toolchain (instead of npm/venv), including aresolve_mavenhelper that prefers./mvnwand falls back to systemmvn.Book@Documentmodel with a compound index and@CreatedDate/@LastModifiedDateauditingBookRepository(MongoRepository) with a derived queryPOST/GET/PATCH/DELETE /books,GET /books/{id},GET /stats/genres(aggregation),GET /healthCrudCompatibilityTest) usingMongoTemplate: connect, index creation, insert (single/many), findById, filtered/sorted queries, count, update,findAndModify, aggregation, unique-index enforcement, delete, and$vectorSearch.README.mdmatching the house style, plus updates to the rootREADME.md(playground table, quick-start example, repository layout).Java-specific TLS handling
Unlike the Node.js/Python drivers, the MongoDB Java driver has no connection-string option to accept a self-signed certificate —
tlsInsecureonly disables hostname verification, not certificate-chain validation. To connect to the emulator's self-signed cert,MongoClientFactoryinstalls a trust-allSSLContext(gated byTLS_INSECURE) and stripsreplicaSet/tlsAllowInvalidCertificatesfrom the shared connection string. For production, setTLS_INSECURE=falseand configure a truststore with the server's CA.Validation
mvn compilesucceeds.Passed: 16 Failed: 0againstdocumentdb-local:latest./healthreturns healthy, book creation populates auditing timestamps + generated id, listing works, and/stats/genresaggregation returns expected results.How to try it
Prerequisites: Docker, JDK 17+, and Maven.