Querying Collections with DocumentDB Studio

I released a first Release Candidate (RC) of DocumentDB Studio (release 1.0.0.1).

DocumentDB Studio is to Azure DocumentDB what SQL Management Studio is to SQL Server and SQL Azure: a one-stop shop to manage and interact with your DocumentDB.

I posted an installation guide of the application and an upgrade guide (both very simple).

 

In this post I want to walk you through the new features of release 1.0.0.1:

  • Telemetry
  • Load folders before they are selected
  • Query collection documents

Load folders before they are selected

This is a simple user-experience feature.

DocumentDB Studio lazy loads folders. We found that lazy loading a bit in the way of usage so we went a little more eager. When you open a folder, we eager load each sub folder (but no their sub folders).

This gives a more fluid user experience.

Query collection documents

The key feature of this release: querying!

In order to query a collection of documents, simply click on a collection folder:

You can then write any queries. Once you wrote your query, you can either click the red exclamation mark on top of the query text box or press F5.

For details on how to query DocumentDB see this documentation.

Telemetry

Let’s get the telemetry out of the way. I want to be totally transparent here. Actually the code for telemetry, both client and server is on codeplex so if you’re into it, you can look it up.

We’ve added telemetry to the smart client in order to gather intelligence on the scenarios you are using it with in order to orient progress.

We did bend backward in order to keep those telemetries anonymous. Let’s look at an example of telemetry entry (yes they are logged in a DocumentDB collection!):

{
“UserID”: “nCNquA25eloB2VWHtjaN+oXti+Y=”,
“SessionID”: “74ab88af-7fe7-402e-a9e8-b4ff8fc08ba1″,
“ReleaseVersion”: {
“TextVersion”: “0.2.1.1”
},
“UpTime”: “00:00:00.0312492″,
“FeatureCounter”: [
{
"Feature": "ViewDocument",
"Count": 10
},
{
"Feature": "QueryDocument",
"Count": 2
}
],
“id”: “5c124d49-686f-4cf5-97df-3be372e3b81f”
}

A UserID!? Yes, a user-id. This is a key to aggregate telemetry’s entries in order to be able to calculate variation across users.

This isn’t the real user-id. Actually, it is a one-way hash of the user login-name and domain-name. A one-way hash means we can’t extract back the original user-id. So you are not sending your user-id to our telemetry service.

Session-ID is simply a GUID generated when you launch the app.

The most important part of the telemetry is the feature counter. We count how many times you use different features. This is key to learn what features are used more often.

So no sensitive information (e.g. real user-id) disclosing, simple anonymous statistics.

If you want to learn more, don’t hesitate to ask question in the comments section.

Conclusion

Querying documents is the key feature of this release and really enable us to explore the Azure DocumentDB product.

Learn More

Here are other articles I wrote about DocumentDB Studio:

More logistic posts:

Also, here are a couple of posts around Azure DocumentDB itself:

DocumentDB Studio 1.0.0 released!

Yes, the first non-beta version!

Ok, what is the difference between the betas and this one? Alpha, Beta and RC are always separated by arbitrary grass lanes…

For DocumentDB Studio, I was waiting to have a Minimal Viable Product (MVP) and for me the MVP was related to be able to query document collections.

Version 1.0.0 does allow you to query documents.

I’ll give more elaborate information with demos in another post within the next few days but you can download it now!

 

Enjoy!

Managing Documents with DocumentDB Studio

I released a second Beta of DocumentDB Studio (release 0.2.0.1).

DocumentDB Studio is to Azure DocumentDB what SQL Management Studio is to SQL Server and SQL Azure: a one-stop shop to manage and interact with your DocumentDB.

I posted an installation guide of the application and an upgrade guide (both very simple). I also posted a guide to Manage Databases and collections in DocumentDB Studio.

In this post I want to walk you through the new features of release 0.2.0.1:

  • Disconnect an account
  • Create Documents
  • List documents under collection
  • View document from the collection
  • Delete document

Account keys

I assume you already have an account ; see this post on how to create an Azure DocumentDB Account. I also assume you have connection to the account in DocumentDB Studio ; see this guide to set it up.

I finally assume you have at least a collection setup ; see this guide to set it up otherwise.

Disconnect an account

First, a trivial feature that was nevertheless missing from the first beta: the ability to disconnect Studio from an account.

In the toolbar, click the Disconnect button:


and confirm you really want to disconnect in the dialog box.

Create Documents

Now, let’s create some documents!

Select a database collection in the tree view and click the Create Document button.


Azure DocumentDB manages Json document. Let’s type a simple document:

{
firstName : “Vincent-Philippe”,
lastName : “Lauzon”,
isActive : true
}

Simply note that json rules and types apply. Here I used strings (in double quotes) and boolean (true without quotes).

Then click OK to save the document to Azure DocumentDB.


List documents under collection

You should see the document appear under your collection as a guid.


Let’s add a few other documents. DocumentDB Studio remembers the last JSON document you enter in that collection, which is a nice starting point.

View document from the collection

Let’s
select one of those document:


This gives us a read-only view of the document.

You will notice the JSON document displayed is your original JSON document plus a couple of meta-data fields added by Azure DocumentDB. The most important of those fields is the id. The id is auto-generated but you can also enter manually when you type the document ; it identifies the document uniquely within a collection.

Delete document

If you want to get rid of a document, simply click the Remove Document button and confirm you really want to delete it.


Conclusion

This release a few key feature allowing you to explore Azure DocumentDB.

The next key feature to be implemented is collection querying.

If you have any feedback on DocumentDB Studio, please do not hesitate to use the discussion board!

Upgrading DocumentDB Studio

See this blog post on how to install Azure DocumentDB Studio from scratch.

Now with release 0.2.0.1 just out of the door, you might want to simply upgrade.

Upgrading is basically the same thing as installing, you just want to keep the file Studio.xml around.

That file keeps your account credentials and is compatible from release to release.

Also, if you run Windows 8, do not forget that it might complain about the fact it doesn’t recognize the application. In that case, click More Info:

Then click Run anyway

Enjoy the new release!

In Azure DocumentDB, DocumentClient.CreateDocumentQuery doesn’t exists!

This is a quick help for you out there who are developing against Azure DocumentDB in .NET.

Maybe you read the Getting Started guide or you found that line of code somewhere else.

var families = client.CreateDocumentQuery(documentCollection.DocumentsLink,

“SELECT * ” +

“FROM Families f ” +

“WHERE f.id = \”AndersenFamily\””);

Then you try this at home only not to find the said CreateDocumentQuery on the class Microsoft.Azure.Documents.Client.DocumentClient.

No it isn’t there. It isn’t because this is a preview service and the doc is out-of-date. It is a good old Linq / extension methods trick.

You need to add the line

using Microsoft.Azure.Documents.Linq; 

at the beginning of your code. This way the code snippet above will actually pick up the extension methods class Microsoft.Azure.Documents.Linq.DocumentQueryable.

Managing Databases and Collections with DocumentDB Studio

I released the first Beta version of DocumentDB Studio.

DocumentDB Studio is to Azure DocumentDB what SQL Management Studio is to SQL Server and SQL Azure: a one-stop shop to manage and interact with your DocumentDB.

I posted an installation guide of the application (very simple).

In this post I want to walk you through:

  • How to connect to a DocumentDB account
  • How to create / delete databases in an account
  • How to create / delete collections within an account

Account keys

You need an Azure DocumentDB account to start using DocumentDB Studio.

See my article Creating an Azure DocumentDB account for an easy how-to. I’ll assume you created such an account.

Now let’s go and retrieve a ??? key.

  1. Go to the Azure Preview Portal: https://portal.azure.com/
  2. On the left hand side, select the BROWSE button and then DocumentDB Accounts
  3. You’ll be presented with the list of DocumentDB accounts you own ; select the one you want to work with.
  4. You will be presented with the account blade. Click the keys button.
  5. In the keys blade, click the copy button next to the secondary key

DocumentDB accounts come with a primary and secondary. Personally, I always like to give applications the secondary key while keeping the primary for myself. But it’s a personal choice, you can use the primary key as well.

Connect to an Account

Now that we have an account and an account key, let’s connect to it in Azure DocumentDB Studio.

  1. Click the Connect button
  2. In the ID textbox, type the ID (or name) of your Database account, without the entire URL.
  3. In the Authorization Key, paste the secondary key you copied in the previous section.

You just connected Azure DocumentDB Studio to your database account.


Note that in the folder where you copied the binaries of the solution, a new file has been added: Studio.xml. This file now contains the ID and authorization key of your database account. This is how your connection persists between instances of the studio.

Creating a database

Now, let’s create a database.

We’ll expand the account tree branch and discover the databases and media. Let’s select the databases.


Everywhere in the resource tree, resources are lazy loaded or loaded on demand. In the case of databases, until you select the tree node, databases aren’t loaded. Once you select it they are asynchronously loaded.

In our case, there are no databases yet, so let’s create one by clicking on the New Database button in the toolbar.


This pops up a dialog to query the ID (or name) of the database. Let’s type MyDB and then click OK.


This creates a MyDB database with no collections.

By opening the MyDB tree node and clicking the Collections sub node the New Collection button in the toolbar becomes enabled.


Let’s click it to create a collection. Very similar experience to creating a database.


Now if we want to delete the collection we just created, we need to select the collection in the tree view to enable the Remove Collection button in the toolbar.


Similarly, to delete the Database we created, we select the Database in the treeview.


So that was it for the management of databases and collection!

Installing DocumentDB Studio

As I announced yesterday, I released the first Beta version of DocumentDB Studio.

DocumentDB Studio is to Azure DocumentDB what SQL Management Studio is to SQL Server and SQL Azure: a one-stop shop to manage and interact with your DocumentDB.

In this blog post I’ll simply walk you through the installation process.

Installation

Simply go to https://studiodocumentdb.codeplex.com/ and follow the big download link on the main page.

The current release is version 0.1.0.38356 but by the time you read this it might be higher.

The current deployment package is a zip file. I wanted to do a Click Once deployment but with a self-signing certificate, Windows 8 seems to refuse to execute it (for security reason), so I fell back on a local install. If you know a way around it, please drop me a line.

There are no install file, simply unzip the file somewhere, e.g. on your desktop. Execute StudioDocDB.exe:

If you run Windows 8, it might complain about the fact it doesn’t recognize the application. In that case, click More Info:

Then click Run anyway

I’ll try to smooth those things out in future release!

After those steps you should see the app!