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 …
-
MongoDB 8.0 Migration Guide: What You Need to Know Before Upgrading
Table of Contents What’s new in version 8.0? General changesQueryable EncryptionExpress query stagesQuery shape and query settingsCompatibility and deprecationsQuery behaviorIndex filtersMigration planning and strategyPre-migration assessment Staging cluster: your testing hubUpgrade production clusterMonitoringCluster node metrics RecapHow complex is your upgrade?Straightforward upgradesMore complex upgradesConclusion Have …
-
GraphQL for Java Developers: Building a Flexible Data Layer
Table of Contents GraphQL fundamentals Why GraphQL fits well in the Spring ecosystemChoosing Netflix DGS with Spring for GraphQLProject setupDependenciesDomain model overviewDefining the GraphQL schemaPersistence with MongoDBQuery resolvers with Netflix DGSMutations and input validationResolving relationships in MongoDBThe N+1 query problemUsing DataLoader …
-
Abstracting Data Access in Java With the DAO Pattern
Table of Contents A simple implementationPrerequisitesThe domain classThe DAO APIThe ProductDao classUsing the DAOUsing MongoDB as the persistence layerSetting up MongoDBThe MongoDBProductDao classConnecting to MongoDBThe application classAdvanced considerationsPreventing business logic leakageAdding custom query methodsError handlingConclusion The Data Access Object (DAO) …