DP-420 · Question #9
DP-420 Question #9: Real Exam Question with Answer & Explanation
The correct answer is A: Create a container for Author and a container for Book. In each Author document, embed bookId. {"question_number": 7, "question_summary": "What is the optimal Cosmos DB data model for a book publisher where the primary query is books by authorId?", "correct_answer": "A", "explanation": "In Cosmos DB, the guiding principle is to model data around your most frequent access p
Question
You maintain a relational database for a book publisher. The database contains the following tables. The most common query lists the books for a given authorId. You need to develop a non- relational data model for Azure Cosmos DB for NoSQL that will replace the relational database. The solution must minimize latency and read operation costs. What should you include in the solution?
Options
- ACreate a container for Author and a container for Book. In each Author document, embed bookId
- BCreate Author, Book, and Bookauthorlnk documents in the same container.
- CCreate a container that contains a document for each Author and a document for each Book. In
- DCreate a container for Author and a container for Book. In each Author document and Book
Explanation
{"question_number": 7, "question_summary": "What is the optimal Cosmos DB data model for a book publisher where the primary query is books by authorId?", "correct_answer": "A", "explanation": "In Cosmos DB, the guiding principle is to model data around your most frequent access pattern. The dominant query is 'list all books for a given author.' Creating a container for Author and a container for Book, and embedding the list of bookIds (or full book subdocuments) within each Author document, means a single point read or efficient partition-scoped query retrieves all books for an author in one round trip. This eliminates cross-partition joins and minimizes both latency and RU cost. Storing Author and Book in the same container with a link document (option B) introduces unnecessary complexity, and separate containers without embedding (option D without denormalization) requires multiple reads.", "generated_by": "claude-sonnet", "llm_judge_score": 3}
Topics
Community Discussion
No community discussion yet for this question.