Book Image

Learning Azure Cosmos DB

By : Shahid Shaikh
Book Image

Learning Azure Cosmos DB

By: Shahid Shaikh

Overview of this book

<p>Microsoft has introduced a new globally distributed database, called Azure Cosmos DB. It is a superset of Microsoft's existing NoSQL Document DB service. Azure Cosmos DB enables you to scale throughput and storage elastically and independently across any number of Azure's geographic regions.</p> <p>This book is a must-have for anyone who wants to get introduced to the world of Cosmos DB. This book will focus on building globally-distributed applications without the hassle of complex, multiple datacenter configurations. This book will shed light on how Cosmos DB offers multimodal NoSQL database capabilities in the cloud at a scale that is one product with different database engines, such as key-value, document, graph, and wide column store. We will cover detailed practical examples on how to create a CRUD application using Cosmos DB with a frontend framework of your choice. This book will empower developers to choose their favorite database engines to perform integration, along with other systems that utilize the most popular languages, such as Node.js. This book will take you through the tips and trick, of Cosmos DB deployment, management, and the security offered by Azure Cosmos DB in order to detect, prevent, and respond to database breaches.</p> <p>By the end of this book, you will not only be aware of the best capabilities of relational and non-relational databases, but you will also be able to build scalable, globally distributed,<br />and highly responsive applications.</p>
Table of Contents (14 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Performing CRUD operations in Graph DB


As discussed in Chapter 3, Cosmos DB Multi-model Databases, a graph data model is a structure that's comprised of vertices and edges. Both vertices and edges can have a set number of properties:

  • Vertices represent discrete objects, such as a person, a place, or an event.
  • Edges represent relationships between vertices. For example, a person might know another person, be involved in an event, and recently have been at a location.
  • Properties denote details about the vertices and edges. Azure Cosmos DB supports the property graph model.

Let's create a new database first:

  1. Click on New Database and choose the Gremlin as API. Refer to the following screenshot for reference:

  1. Now, create a new graph database and Graph Id. Refer to the following screenshot for reference:

  1. Now, you need to generate the keys to connect it via any programming interface. Go to Settings | Keys and click on the primary and secondary keys to generate it. Refer to the following screenshot for...