Modeling One-to-Many Relationships in Java with MongoDB
Table of Contents What You'll LearnPrerequisitesProject SetupConfiguring the MongoClient with POJO SupportWhat Is a One-to-Many Relationship in Java?How Does MongoDB Store Documents Differently Than a Relational Database?Pattern 1: Embedded DocumentsWhen Should You Embed?Modeling Embedded Documents in JavaInserting and Querying Embedded ...
-
Clean Architecture with Spring Boot and MongoDB
Table of Contents Prerequisites1. What is Clean Architecture?2. Project structure3. Building the domain layer4. Building the application layer5. Building the MongoDB adapter6. Wiring everything with Spring BootConclusion Most Spring Boot tutorials tightly wire everything together. Controllers call services, services call …
-
Building Reactive Data Streams with Project Reactor
Table of Contents Creating Non-Blocking Streaming Endpoints for High-Throughput ApplicationsFrom Snapshots to StreamsProject SetupDomain Model: Telemetry as a Streamable DocumentReactive RepositoryService Layer: Explicit Backpressure StrategyStreaming Endpoint with Server-Sent EventsThe Real Bottleneck: Waiting, Not WorkingThe Most Dangerous Line of CodeResource Efficiency …
-
Build a Spaced Repetition Flashcard API with Spring Boot & MongoDB (Part 1)
Table of Contents GitHub Repository: Complete SRS Flashcard App CodeHow to Create a Spring Boot Project with Spring InitializrConfigure MongoDB Connection URI in Spring BootFlashcard System: Logical Data Model & ERDMongoDB Schema Design: One-to-Many RelationshipsJava Model Classes: Deck and FlashCard …
-
Atlas Online Archive: Efficiently Manage the Data Lifecycle
Table of Contents Problem statementResolutionAdvantagesLimitationsPre-requisitesOnline archival configuration setupConclusion Problem statement In the production environment, in a MongoDB Atlas database, a collection contains massive amounts of data stored, including aged and current data. However, aged data is not frequently accessed through …
-
Event-Driven Architecture in Java and Kafka
Table of Contents Streaming Data – The Air Traffic Control Example.Reactive Java – a brief historyReactive Java with MongoDB and KafkaBlocking Code VersionReactive Code VersionBlocking Versus Reactive Application Performance.Final Thoughts Reactive Java is well suited to modern streaming, event driven …
-
Role-Based Access Control in Java Applications
Table of Contents Authorization Is a Business ConcernModeling Permissions FirstUsing MongoDB for User MetadataFrom Infrastructure Model to Application PrincipalCentralizing Authorization LogicContextual Rules: Where RBAC StopsRBAC vs ABAC: When Roles Are Not EnoughThe Architectural PayoffConclusion We often work with Java applications …
-
Data Enrichment in MongoDB
Table of Contents Concurrency in data enrichmentMachine concurrency Human concurrencySchema design patternsBest practicesPlan for concurrencyUse a separate collection for pessimistic lockingAdd an auto-save to your application when humans and locks are involvedRelease the lock app-side on logout Anti-patternsUsing separate (temporary) collections to …
-
How to Build a Search Service in Java with MongoDB
Table of Contents PrerequisitesSearch service designSearch service interfaceReturned resultsSearch service implementationGETting the search resultsAggregation pipeline behind the scenes$search in codeField projectionAggregating and respondingTaking it to productionFuture roadmapConclusion We need to code our way from the search box to our search …
-
MongoDB and the Raft Algorithm
Table of Contents Raft Roles and MongoDB’s Replica SetLog Replication: Ensuring ConsistencyCommitment and Durability in MongoDBFailure Handling and RecoveryMongoDB-Specific Optimizations in RaftConsistency Levels with RaftRaft vs. Paxos: Why Chose RaftConclusion MongoDB’s replica set architecture uses distributed consensus to ensure consistency, …
-
Ports and Adapters in Java: Keeping Your Core Clean
Table of Contents IntroductionWhy “Clean Core” Still Matters in 2026Hexagonal Architecture Recap Ports: Defining What the Core NeedsThe Domain Model Must Stay IgnorantMongoDB as an Adapter — Not a RepositoryMapping Between Domain and Persistence ModelsTesting: Where the Architecture Pays OffSpring Boot …