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 ...
-
Language Learning Flashcard System – Part 1
Table of Contents Complete code exampleCreate a project using Spring InitializrAdding the MongoDB Connection URIOur logical modelOur MongoDB schemaOur model classesImproving our development cycleOur first API endpointsDecksCardsAdding empty endpoints for DecksChanging the default portTesting our endpointsRepositoriesServicesWiring up our ControllersNext steps …
-
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 …
-
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 …
-
Optimizing the MongoDB Java Driver: How minor optimizations led to macro gains
Table of Contents Getting the metrics rightHow we measured performance2. Java Virtual Machine (JVM) intrinsics3. Check and check again4. BSON null terminator detection with SWAR5. Avoiding redundant copies and allocations6. String Encoding, removing method indirection and redundant checks Lessons learned Co-authored …
-
MongoDB Sharding: What to Know Before You Shard
Table of Contents Sharding as a horizontal scaling strategyUnderstanding a sharded cluster architectureShardsConfig serversMongosDistributing data in a sharded clusterWhen should you shard a collection?Vertical limits or costLarge datasetsFaster backup and restore timesHigh write or throughput requirementsZonal or regional data requirementsChoosing …
-
Reactive Java with Project Reactor
Table of Contents Reactive Streams: The Contract Behind ReactorProject Reactor Core ConceptsBackpressure: The Hard Part Reactive Does Not Mean FasterMongoDB Reactive Driver: Architecture OverviewIntegrating MongoDB Reactive Driver with Project ReactorPerformance Considerations with Reactive MongoDBReactive Architecture Patterns with MongoDBWhen NOT to Use …