Guide to NoSQL with Azure Cosmos DB

Book description

Create scalable applications by taking advantage of NoSQL document databases on the cloud with .NET Core

Key Features

  • Work with the latest available tools related to Cosmos DB
  • Learn to work with the latest version of the .NET Core SDK, C# and the SQL API
  • Work with a database service that doesn't require you to use an ORM and provides flexibility

Book Description

Cosmos DB is a NoSQL database service included in Azure that is continuously adding new features and has quickly become one of the most innovative services found in Azure, targeting mission-critical applications at a global scale. This book starts off by showing you the main features of Cosmos DB, their supported NoSQL data models and the foundations of its scalable and distributed architecture. You will learn to work with the latest available tools that simplify your tasks with Cosmos DB and reduce development costs, such as the Data Explorer in the Azure portal, Microsoft Azure Storage Explorer, and the Cosmos DB Emulator.

Next, move on to working with databases and document collections. We will use the tools to run schema agnostic queries against collections with the Cosmos DB SQL dialect and understand their results. Then, we will create a first version of an application that uses the latest .NET Core SDK to interact with Cosmos DB. Next, we will create a second version of the application that will take advantage of important features that the combination of C# and the .NET Core SDK provides, such as POCOs and LINQ queries. By the end of the book, you will be able to build an application that works with a Cosmos DB NoSQL document database with C#, the .NET Core SDK, LINQ, and JSON.

What you will learn

  • Understand the supported NoSQL data models and the resource hierarchy
  • Learn the latest tools to work with Cosmos DB accounts and collections
  • Reduce your development costs by working with the Cosmos DB Emulator
  • Understand request units, automatic indexing, partitioning, and billing
  • Build an application with C#, Cosmos DB, .NET Core SDK, and the SQL API
  • Perform asynchronous operations with databases, and documents in C#
  • Work with models, and customize serialization of LINQ queries

Who this book is for

This book is for C# developers. You do not require any knowledge of Azure Cosmos DB, but familiarity with the Azure platform is expected.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Guide to NoSQL with Azure Cosmos DB
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Introduction to NoSQL in Cosmos DB
    1. Making the paradigm shift to the NoSQL way
    2. Learning about the main features of Cosmos DB
    3. Understanding the supported NoSQL data models
    4. Using the appropriate API for each data model
    5. Diving deep into the Cosmos DB resource model
    6. Understanding the system topology NoSQL
    7. Learning about the resource hierarchy for each container
    8. Test your knowledge
    9. Summary
  7. Getting Started with Cosmos DB Development and NoSQL Document Databases
    1. Provisioning a Cosmos DB account that uses the SQL API
    2. Understanding URIs, read-write and read-only keys, and connection strings
    3. Creating a new document database with the SQL API
    4. Creating a new collection
    5. Populating a collection with documents
    6. Understanding automatically generated key-value pairs
    7. Understanding schema-agnostic features
    8. Working with the web-based Azure Cosmos DB Explorer
    9. Using Azure Storage Explorer to interact with Cosmos DB databases
    10. Working with the Azure Cosmos DB Emulator
    11. Test your knowledge
    12. Summary
  8. Writing and Running Queries on NoSQL Document Databases
    1. Running queries against a collection with different tools
    2. Understanding query results in JSON arrays
    3. Checking the request units spent by a query
    4. Working with schema-agnostic queries
    5. Using built-in array functions
    6. Working with joins
    7. Using array iteration
    8. Working with aggregate functions
    9. Test your knowledge
    10. Summary
  9. Building an Application with C#, Cosmos DB, a NoSQL Document Database, and the SQL API
    1. Understanding the requirements for the first version of an application
    2. Understanding the main classes of the Cosmos DB SDK for .NET Core
    3. Creating a .NET Core 2 application to interact with Cosmos DB
    4. Configuring a Cosmos DB client
    5. Creating or retrieving a document database
    6. Querying and creating document collections
    7. Retrieving a document with an asynchronous query
    8. Inserting documents that represent competitions
    9. Calculating a cross-partition aggregate with an asynchronous query
    10. Reading and updating an existing document with a dynamic object
    11. Querying documents in multiple partitions
    12. Calling asynchronous methods that create and query dynamic documents
    13.  Test your knowledge
    14. Summary
  10. Working with POCOs, LINQ, and a NoSQL Document Database
    1. Creating models and customizing serialization
    2. Retrieving a POCO with a LINQ asynchronous query
    3. Inserting POCOs
    4. Calculating a cross-partition aggregate with an asynchronous LINQ query
    5. Reading and updating an existing document with a POCO
    6. Querying documents in multiple partitions with LINQ
    7. Writing LINQ queries that perform operations on arrays
    8. Calling asynchronous methods that use POCOs to create and query documents
    9. Inspecting the SQL API queries that LINQ generates
    10. Test your knowledge
    11. Summary
  11. Tuning and Managing Scalability with Cosmos DB
    1. Understanding request units and how they affect billing
    2. Dynamically adjusting throughput for a collection with the Azure portal
    3. Working with client-side throughput management
    4. Understanding rate limiting and throttling
    5. Tracking consumed request units with client-side code
    6. Understanding the options for provisioning request units
    7. Learning portioning strategies
    8. Deploying to multiple regions
    9. Understanding the five consistency levels
    10. Taking advantage of regional failover
    11. Understanding indexing in Cosmos DB
    12. Checking indexing policies for a collection with the Azure portal
    13. Test your knowledge
    14. Summary
  12. Answers
    1. Chapter 1: Introduction to NoSQL in Cosmos DB
    2. Chapter 2: Getting Started with Cosmos DB Development and NoSQL Document Databases
    3. Chapter 3: Writing and Running Queries on NoSQL Document Databases
    4. Chapter 4: Building an Application with C#, Cosmos DB, a NoSQL Document Database, and the SQL API
    5. Chapter 5: Working with POCOs, LINQ, and a NoSQL Document Database
    6. Chapter 6: Tuning and Managing Scalability with Cosmos DB
  13. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Guide to NoSQL with Azure Cosmos DB
  • Author(s): Gaston C. Hillar, Daron Yondem
  • Release date: September 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789612899