Spring Data for NoSQL
22 questions in 6 subtopics.
MongoDB
Map an Order document with embedded line items in Spring Data MongoDB, and write a repository method that finds orders by customer id sorted by date.A Spring Boot service needs multi-document transactions in MongoDB. What are the requirements and costs?When would you embed related data in a MongoDB document and when would you reference other documents? Use orders, customers and products as examples.Your company built its main product on MongoDB ten years ago with no schema enforcement, and now has documents in many historical shapes. What long-term plan would you set?Redis
What is the difference betweenRedisTemplate and StringRedisTemplate, and why do keys sometimes appear as unreadable bytes in Redis?Configure Spring Cache with Redis so that product lookups are cached for 10 minutes, and explain the cache-aside behaviour.You need a distributed lock so that only one instance runs a scheduled job at a time. Discuss using Redis for this, and alternatives.Redis is used by 50 services for caching, sessions, rate limiting and queues in one shared cluster. What risks do you see, and what would you change?Several open-source data stores your company relies on have changed licences in recent years, and cloud providers offer forks or compatible services. How would you decide whether to stay, move to a fork, or move to a managed compatible service?Elasticsearch
How do you use Spring Data Elasticsearch to index and search products, and why is Elasticsearch usually not the primary store?Design how product changes in PostgreSQL reach an Elasticsearch index reliably, including full reindexing without downtime.Search is run on a self-managed Elasticsearch cluster by one team, and other teams want to add their own indexes to it. How would you decide on ownership, tenancy and the platform choice?Cassandra
In Cassandra, what are the partition key and clustering columns, and why can you not query freely by any column as in SQL?Model a Cassandra table for 'latest 50 messages per conversation' with Spring Data Cassandra. Explain partition and clustering keys and the pitfalls.A team proposes Cassandra for a new order service because of its write scalability. What questions would you ask before approving?Choosing SQL vs NoSQL
What factors would make you choose a relational database over a document database for a new service?A team stores user profiles in MongoDB, but new features need reporting with joins across profiles, orders and payments in PostgreSQL. What would you recommend?Teams have adopted six different databases over the years. How would you create a database technology policy that balances team autonomy with operational cost?Looking back at the NoSQL wave of the 2010s and the later return of relational databases with JSON support and distributed SQL, how would you advise an organisation making database bets for the next ten years?DynamoDB
How do you access DynamoDB from a Spring Boot service, and how do partition keys and sort keys determine what queries are possible?A DynamoDB table backing an order service throttles withProvisionedThroughputExceededException during a sale, even though total consumed capacity is far below the table's limit. What is likely happening and how do you fix it?A team wants to move an order service from PostgreSQL to DynamoDB to reduce operational work. What questions would you ask, and what risks would you highlight?No question matches these choices.