You are previewing Learning Azure DocumentDB.
O'Reilly logo
Learning Azure DocumentDB

Book Description

Create outstanding enterprise solutions around DocumentDB using the latest technologies and programming tools with Azure

About This Book

  • Get to know the concepts of DocumentDB and learn to work your way around it
  • Manipulate and query your documents using different modern technologies to access DocumentDB
  • Build a real-life scenario using Microsoft Visual Studio and C# with this handy and practical guide

Who This Book Is For

This book is for novice developers and database architects who need a thorough knowledge of the features of DocumentDB and developing applications with it. Basic knowledge of SQL would be helpful.

What You Will Learn

  • Create, manage, and configure your DocumentDB environment
  • Execute SQL queries from simple to complex and nested ones against your database
  • Get to know about advanced DocumentDB techniques such as scopes, portioning, indexing, triggers, UDF’s, and security
  • Fine-tune your DocumentDB database to optimize performance and costs
  • Interact with DocumentDB from different technologies and platforms
  • Build a real-life scenario using C# and put DocumentDB at the heart of Azure solutions
  • Understand how to migrate from your current datastore to DocumentDB

In Detail

Learning DocumentDB adopts a practical, step-by-step approach to help you learn the basics of DocumentDB and use your new-found abilities in real-life scenarios and enterprise solutions.

We start with the absolute basics, such as setting up a DocumentDB environment, and guide you through managing your databases, and executing simple and complex queries. Next, we explain how to work with DocumentDB using the open REST protocol, and demonstrate how JavaScript works with DocumentDB. We’ll also show you how to authenticate and execute queries. Moving on, you’ll find out how to use DocumentDB from within Node.js to kick-start your Node.js projects. Next, you’ll discover how to increase the performance of your DocumentDB database and fine-tune it.

Finally, you’ll get to grips with using DocumentDB in conjunction with other services offered from the Microsoft Azure platform.

Style and approach

This book can be used as a tutorial where you learn step by step, but also as a knowledge base to quickly look up recipes you can instantly utilize. Starting with the basics and moving on to advanced topics, every concept is explained in theory and demonstrated through easy-to-understand examples.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning Azure DocumentDB
    1. Table of Contents
    2. Learning Azure DocumentDB
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with DocumentDB
      1. What is DocumentDB?
        1. The characteristics of a schema
        2. Having JavaScript at the core
        3. Indexing a document
        4. DocumentDB as a service
        5. Understanding performance
        6. Handling transactions
        7. Common use cases
          1. Building the Internet of Things
          2. Storing user profile information
          3. Logging information
          4. Building mobile solutions
      2. Exploring the data model
        1. DocumentDB account
        2. Creating databases
          1. Administering users
          2. Setting permissions
        3. Managing collections
      3. DocumentDB versus other databases
        1. Azure Table storage
        2. MongoDB
        3. Comparison chart
      4. Understanding the price model
        1. Account charges
        2. Number of collections
          1. Request Units
        3. Understanding storage
        4. Expanding resources
      5. Building your first application
        1. Provisioning an account
        2. Creating a database
        3. Creating a collection
        4. Building a console application
          1. Setting up a solution
          2. Saving a document
      6. Summary
    9. 2. Setting up and Managing Your Database
      1. Managing your keys
        1. Recycling keys
        2. Managing read-only keys
      2. Using resource tokens
        1. Creating resource tokens
          1. Creating a collection
          2. Creating a user and its permission
          3. Creating a document with permissions
          4. Creating a document without permissions
          5. Listing permissions
        2. Setting consistency levels
      3. Managing alerts
        1. Monitoring your account
        2. Creating alerts
      4. Summary
    10. 3. Basic Querying
      1. Creating resources
        1. Creating a collection
        2. Creating a document
          1. Using DocumentDB SQL
          2. Using LINQ to object
          3. Using LINQ
          4. Updating the PersonInformation
      2. Reading resources
        1. Reading documents
          1. Using the WHERE clause
          2. Using a simple JOIN
      3. Updating documents
        1. Updating documents
      4. Deleting documents
      5. Summary
    11. 4. Advanced Querying
      1. Using the SELECT statement
        1. Selecting some documents
      2. Using the FROM clause
        1. Aliasing
          1. Joining documents
        2. Selecting from subdocuments
      3. Using the WHERE clause
        1. Binary operators
        2. The BETWEEN keyword
        3. Logical operators
        4. Using the IN keyword
        5. Conditional expressions
      4. Using built-in functions
      5. Building stored procedures
      6. Building triggers
      7. Building user-defined functions
      8. Using LINQ to DocumentDB
      9. Summary
    12. 5. Using REST to Access Your Database
      1. Understanding the basics of REST
        1. Using the GET verb
        2. Using the POST verb
        3. Using the PUT verb
        4. Using the DELETE verb
      2. Querying DocumentDB resources
        1. Setting request headers
        2. Generating the authorization header
      3. Getting all databases
      4. Adding a document
      5. Summary
    13. 6. Using Node.js to Access Your Database
      1. Introducing Node.js
        1. What is Node.js?
        2. Why use Node.js?
        3. Preparing Visual Studio 2015
        4. Building our first Node.js application
          1. Creating our first app
          2. Creating a web app
      2. Utilizing DocumentDB from Node.js
        1. Preparing our project
        2. Connecting to DocumentDB
          1. Creating a module
          2. Creating and finding a document
      3. Summary
    14. 7. Advanced Techniques
      1. Introducing indexes
        1. Explaining default indexing
        2. Customizing indexing policies
          1. Configuring index update mode
            1. Consistent indexing mode
            2. Lazy indexing mode
            3. None indexing mode
          2. Setting index precisions
          3. Manipulating paths in indexes
          4. Setting different index types
          5. Configuring index paths
          6. Setting the index precision
      2. Partitioning data
        1. Using hash partitioning
        2. Using range partitioning
      3. Managing performance
      4. Using transactions
      5. Setting consistency levels
        1. Using strong consistency
        2. Using bounded staleness consistency
        3. Using session consistency
        4. Using eventual staleness consistency
      6. Summary
    15. 8. Putting Your Database at the Heart of Azure Solutions
      1. Introducing an Internet of Things scenario
        1. IoT Inc.
        2. Technical requirements
          1. Designing the model
          2. Building a custom partition resolver
        3. Building the Web API
          1. Registering a device
      2. Increasing search capabilities
        1. Setting up Azure Search
      3. Enhancing security
        1. Creating and configuring Key Vault
        2. Using Key Vault from ASP.NET
        3. Encrypting sensitive data
      4. Migrating data
      5. Summary
    16. Index