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

Using the WHERE clause


Filtering can be done by using the WHERE clause. The conditions we add in the clause will cause DocumentDB to filter the collection, and any document must evaluate the specified conditions to be true, otherwise they will not be part of the result set. To demonstrate several operators in the WHERE clause, our current PersonInformation document will be expanded with several properties. The support C# solution from Chapter 3, Basic Querying, will be upgraded with this new requirement:

  • Every document will contain an indicator on how many devices this specific person has at home to support home automation

  • An additional subtree containing the actual home automation devices including the price of the device will be added

This section will demonstrate multiple operators for the WHERE clause:

  • Binary operators

  • The BETWEEN keyword

  • Logical operators

  • The IN keyword

  • Conditional expressions

Binary operators

Currently, DocumentDB supports the following binary operators:

Arithmetic

+, -, ...