Book Image

Learning Azure DocumentDB

By : Riccardo Becker
Book Image

Learning Azure DocumentDB

By: Riccardo Becker

Overview of this book

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.
Table of Contents (15 chapters)
Learning Azure DocumentDB
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

In August 2014, Microsoft announced the preview of their DocumentDB service offering. DocumentDB is a NoSQL database that meets the requirements of today's applications that evolve at a higher pace, including modifications to the data model. DocumentDB covers all this by offering a schema-free document database that offers flexibility, scalability, automated indexing, and a mature range of querying possibilities. Recently, Microsoft announced support for geospatial indexing and querying, opening a whole new range of possibilities.

Setting an example, Microsoft utilizes DocumentDB in its renewed http://www.msn.com, servicing 450 million unique monthly visitors. 25 percent of these visitors have their own personalized data and this data is services from DocumentDB.

DocumentDB greatly enhances the flexibility of your evolving applications and offers a rich querying environment for any kind of data that you store.

This book covers all the concepts and possibilities of DocumentDB by covering the theory with lots of examples in every chapter. This book is linear and every chapter builds on the knowledge of the last. For the more experienced users, chapters can also be read individually and in any order.

By the end of this book, you will be able to use DocumentDB in your own daily work and benefit from best practices.

What this book covers

Chapter 1, Getting Started with DocumentDB, covers the basics of DocumentDB. It explores the data model and compares DocumentDB with other NoSQL technologies. It also outlines the pricing model of DocumentDB. By the end of this chapter, we will learn how to set up a DocumentDB environment and how to prepare Visual Studio 2015 to start building solutions using DocumentDB.

Chapter 2, Setting up and Managing Your Database, provides detailed information on how to set up, maintain, and manage your DocumentDB. It also covers how to monitor your DocumentDB and, based on monitoring results, reconfigure DocumentDB.

Chapter 3, Basic Querying, provides an insight into the basic querying options for DocumentDB. It covers how to create, update, read, and delete documents from your DocumentDB in the most basic form.

Chapter 4, Advanced Querying, provides an insight into all the possibilities in the SQL grammar that is available for DocumentDB.

Chapter 5, Using REST to Access Your Database, discusses how to use DocumentDB using the open REST protocol. It also covers how to use JavaScript to work with DocumentDB and how to authenticate and execute queries.

Chapter 6, Using Node.js to Access Your Database, provides a detailed description of how to use DocumentDB features with Node.js

Chapter 7, Advanced Techniques, covers indexes and how to use them effectively. It also covers how to measure the performance of our database and use partitioning techniques.

Chapter 8, Putting Your Database at the Heart of Azure Solutions, describes patterns that can be applied to your Azure solution, collaborating with DocumentDB. It also covers some patterns and how to integrate DocumentDB inside your current Azure solution by replacing some of the current data repositories, which will be moved to DocumentDB.

What you need for this book

The softwares that are needed to follow the examples outlined in this book are as follows:

  • Visual Studio 2015 (any version)

  • Azure SDK 2.7

  • DocumentDB .NET SDK Version 1.5

  • An Azure subscription

  • A modern browser

Who this book is for

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

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "A good example of a UDF is a function called calculateAge() that takes the date of birth of a person and returns the age as a value."

A block of code is set as follows:

User user = await client.ReadUserAsync(readUser.SelfLink);

  FeedResponse<Permission> permissions = await client.ReadPermissionFeedAsync(readUser.SelfLink);
  foreach (var permission in permissions)
  {
    Console.WriteLine(permission.Id + ":" + permission.ResourceLink + ":" + permission.PermissionMode.ToString());
  }

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on the New Support button and follow the wizard that shows up."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/2467EN_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.