DocumentDB was announced on 22nd October as a preview feature. User can provision through the new azure portal.
If you are not familiar or this is the first time you hear about DocumentDB, I'd like suggest you to read my previous post. I also recommend you to read some documents about it in Microsoft Azure website.
What's "My DocumentDB" & Why I Created It
"My DocumentDB" is a web-based DocumentDB Management tool I had just created. The reason I created is because, in azure portal there's very few features for us to manage a DocumentDB.
As you can see it's easy to create or delete a DocumentDB account in azure portal as below.
And inside an existing DocumentDB account there are many monitors and status reports. We can also create and delete a databases, and view the collections' basic information under a certain database.
But that's all. I found that we cannot create or delete a collection, cannot create, update or delete a document under a collection. This makes me a little bit hard to use when I'm working with DocumentDB. Hence this is the reason why I created "My DocumentDB". And in order to make it cross-platform and easy to use, I decided to create a web-based tool rather than a client application.
"My DocumentDB" Features (Currently)
Currently there are three features in "My DocumentDB":
- Database Management: List, create and delete a database.
- Collection Management: List, create and delete a collection under a certain database.
- Document Management: List, create, update and delete a document under a certain collection.
Below is the home page of "My DocumentDB". On the top right corner we need to specify the host and key we want to connect.
The host and key can be copied from the DocumentDB details page from azure portal as below.
After specified the host and key, press the "Connect" button. Then there will be two menu items appeared as below. The "Explorer" menu navigates us to the main management pages. The "Console" page content is still under developed.
Ref the credentials and potential security risks please refer to the security section later in this post.
Click "Explorer" menu will list all databases in the DocumentDB account. And we can create and delete a database by clicking the related button.
Note that when we are going to delete a database, it asked us to re-input the database ID for double verification.
Click a database ID will list all its collections. In this page we can create and delete collections as well. Similarly, when deleting a collection we also need to re-input the ID.
Click a document ID will list all its documents. In this page the document ID and resource ID will be displayed by default. If you want to view the content of the document you can click the arrow icon in front of each row as below.
We can create, edit and delete a document from this page as well. When deleting a document we also need to re-input its ID. When create or edit a document we need to provide the ID as well as the content. Since the document is a JSON, in the popup window we need to specify in JSON format. Currently we only support raw JSON string in the "Raw" tab. In the future we might introduce a JSON editor.
The ID property was specified from the separated input box in this window so we don't need to put it into the content box. And if we specified ID in both places the one in the content will be replaced. For example, I specified ID in top input box with value "123" and in the content input box you specified as below.
2: "id": "456",
Then the document inserted into DocumentDB will be
Below is the new document I had just created.
Source Code & Deployment
You can find the source code of "My DocumentDB" on GitHub. And Currently there are three ways to use "My DocumentDB".
The first one is to use the live demo I deployed in Azure Website located at North Europe data center. This is the most easy way. But it might introduce connection legacy and cost if your DocumentDB was created in other data centers.
The second way is to deploy "My DocumentDB" in your Azure account. This is simple, too. Since it's designed for Azure, what you need to do is to download the source code from GitHub and deploy to any Azure Website you have.
The last choice, you can deploy "My DocumentDB" on premise. Similar as the previous one, download the source code to you desktop, make sure you have Node.js installed and execute the command as below. Since "My DocumentDB" is hosted by Node.js, you can run it under Windows, Linux and Mac.
1: node.exe server.js --port=[port number] [--debug]
When deploying "My DocumentDB" locally you need to ensure the Internet connectivity without proxy. Currently we don't support local deployment under a proxy Internet connectivity environment.
I created "My DocumentDB" and worked in spare time so that I didn't pay more effort in security consideration. There might be some risks when you are using it please be aware. And since "My DocumentDB" was released with MIT license I will NOT provide any warranties.
No SSL connection. Currently "My DocumentDB" will be hosted with HTTP instead of HTTPS. This means the data between your browser and "My DocumentDB" server can be seen by others. But the connection to Azure DocumentDB is HTTPS. You can change the source code to enable HTTPS if you are going to deploy to your own azure service or local.
Wildcard SSL Certificate
Azure Website support wildcard certificate for its all sites. This means you can simply use https://mydocdb.azurewebsites.net for security connection on the live demo. But if you need more security request I'd like you deploy to your own azure account with your certificate.
Based on these risks I personally recommend
1. Click "Disconnect" button when you don't use it, or when you need to leave for a moment.
2. Local deployment provides better security boundary than using live demo since all sensitive data are stored in your machine, and the connection to Azure DocumentDB is HTTPS.
As I mentioned below this is the first version of "My DocumentDB". Based on your feedback and usage there might be more features in pipeline I'm going to implement. Below are some of them in my mind. Hopefully I have passion and energy to work them out.
In the console page user can execute DocumentDB query console against database, collection or document. Developers can try their query and check the result before implementation.
2. JSON editor
Currently user has to use plaint JSON string when create or edit a document. In the future I will add a JSON designer in document edit window.
Currently I didn't specify any paging options in requests. But if there are many documents in a collection we'd better let users specify how many items per page they like.
4. More to manage
We only support databases, collections and documents management, but there are many more things in DocumentDB such as users, stored procedures, triggers and attachments, etc. They should be able to be managed as well in the future.
Feedbacks & Issues
I encourage everyone to try "My DocumentDB", either from the live demo, or self host on azure or local. If you have any questions or issues please feel free to contact in the GitHub page.
Hope this helps,
All documents and related graphics, codes are provided "AS IS" without warranty of any kind.
Copyright © Shaun Ziyan Xu. This work is licensed under the Creative Commons License.