Querying In The Azure DocumentDB: Day Two

Before reading this article, I’ll suggest you read the previous article of the series:

As you easily understood DocumentDB through the previous article, now the question is:

Question: Can we perform the querying in DocumentDB also?

So, the answer is yes, we can perform edit, delete, and create querying operations in the DocumentDB.

So let’s do it step by step as in the following:

Go to Microsoft Azure Sign In window and fill the username and password to log in your account.

sign in

In the Azure portal, scroll down and go to the “Browse” option and select “DocumentDB Accounts”.

Note:
I already created DocumentDB Account in the previous article.

dashboard

You will see your DocumentDB Account in the next window, if there is no account simply go to the “Add” option and create your account.

Here I have my account “nitindocdb,” I’m going to click on it, clicking it will redirect to next window. In this window we can find our database, if it is there, scroll down and click on your database, I have created “docdatabase” named database. If there you don’t have any database, go to the “Add Database” option in the menu.

menu

After clicking on the database you will be redirected to the “Document Explorer” window, where you will find your created database and collations.

I need to create documents, so click “Create Document”.

create

In the next figure, you can see there is a JSON type script where we need to enter a unique id value; it could be your name or your friends name.

new

Here, I gave the name Nitin” in the ID section.

Click “Save” button to save the script.

After clicking on the “Save” button, it gives you a particular id. (See in the Document Explorer).

save


I’m going to write some JSON in the same document, you can write any type of JSON script in that document.

After completing your script, click on the “Save” button to save your script.

script

Script will be saved; you can call your script through the query, so let’s go for querying.

Go to backward in the menus and select “Query Explorer”.

In the Query Explorer window you will see a short command with your Database and Collections.

Here c is an object. We can call our JSON property through the c object, here c object is not mandatory for you, you can take any type of object like (a,b,f…..etc).

query explorer

In the next figure, I am adding some more commands and calling my JSON property through the c object.

After completing the command process, hit on the “Run query” button.

run query

I have successfully obtained my result that is JSON script, in which I have defined in the document explorer. So we can edit, delete, and create our script according to use, and can call the script through the query.

script

Let’s understand the menus in the DocumentDB Account.

Settings:

In the DocumentDB the first level would be “Settings,” it contains the whole DocumentDB setting information like keys of the DocumentDB account, where you can find the”URI” and “Keys” of the account. In the properties, you can find the status and location of your account.

setting

Add Database:

In this you can create a particular database, with the unique id, where you can add collections.

Add Database

Document Explorer:

Document Explorer is a place where you can see your databases and collections in the dropdown menu. In this, you can also see your list of documents, and also it means means your created and uploaded documents in the JSON extension.

Let’s focus on Document Explorer menu-

Create Document:

In this, you can create JSON scripts; after saving the JSON scripts, it will save as a ID and known as document.

Add Document: You can upload 100 JSON documents.

Refresh: You can refresh the Document Explorer.

Settings: In the settings, you can select the items per page like custom or unlimited.


document

Query Explorer:

In the Query Explorer, you can choose the database and collections according to use,  which means in which database and collection you want to perform Querying.

You can also Load the Query from the outsource collection, and perform the operations on that selected script.

Query Explorer

Script Explorer:

It is one of the important menu items of the Document Explorer. In Script Explorer you can create stored procedures and triggers as well as user defined functions. And if you save any script then it gets saved as a script.

Script Explorer

Import Data: You can import data in to DocumentDB also,
  • You can import JSON file data to DocumentDB.
  • You can import CSV file data to DocumentDB.
  • You can import SQL Server data to DocumentDB.
  • You can import MongoDB data to DocumentDB.
  • You can import data from Azure Table storage to DocumentDB.
  • You can import data from Amazon DynamoDB to DocumentDB.
  • You can import data from HBase to DocumentDB.
  • You can migrate data between DocumentDB collections.

For more information visit:


import

Move: You can move to resources.

move

Delete Account:

You can delete your accounts, by simply selecting your account which you want to delete and click on “Delete Account” button.

delete

I hope you enjoyed this article. Stay tuned for Day Three.

Thanks for reading.

Connect (“Nitin Pandit”);
 
Read more articles on Azure:


Similar Articles