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

Adding data in MongoDB


Let's add few data in the MongoDB:

  1. Once the collection is created, you can add new documents to it. Click on Data Explorer from the left menu and select the database.
  2. Refer to the following screenshot if you are having difficulty finding the database:

  1. Click on New Document and it will open up the query editor. Copy the following document and paste in the editor, or you can create your own:
{ 
    "id": "10", 
    "name": "Shahid", 
    "location": "India" 
} 
  1. You can add more fields of your choice. Click on the Save button to add the record in the MongoDB collection. Repeat the steps to add multiple documents.
  2. You can also query the data you have added in the collection from the Data Explorer screen. Click on the New Mongo Query button on the top menu and it will open up an editor. Add any Mongo query you like, or just add {} to fetch all documents from the MongoDB collection.
  3. Refer to the following screenshot to see how it works:

Results may vary on your account.

So far we...