Delen via


Edit and Query documents through the Azure portal

Edit and Query documents through the Azure portal

We’ve released a number of great enhancements to further improve the DocumentDB management experience.  Our October 23rd portal update lights up the following new capabilities through https://portal.azure.com:

  • Document CRUD operations – create, edit and delete documents
  • Document system properties – view system properties for each document
  • Document filtering and refresh – filter and refresh results within Document Explorer
  • Query Explorer – author and run DocumentDB SQL queries

Keep reading for some additional information on each of these new features!

Document CRUD operations

Document Explorer has been enhanced such that you can create, edit and delete documents.  To create a document, simply click the Create Document command and a minimal JSON snippet will be provided:

Note that if you choose to not provide an id, Document Explorer will automatically generate a GUID as the id value. 

Once I click save, the document is updated to reflect the supplied (or generated) id:

Additionally, the document is added to the bottom of the document list in Document Explorer:

To edit an existing document, simply select it in Document Explorer, edit the document as you see fit, and click the Save command:

Likewise, you can delete a document by selecting it, clicking the Delete command and then confirming the delete (after confirming, the document will immediately be removed from the Document Explorer list):

If you’re editing a document and decide that you want to discard the edits, simply click the discard command, confirm the discard action, and the previous state of the document will be reloaded:

Note that Document Explorer will validate that the document contains valid JSON:

And will also prevent you from saving a document with invalid JSON content:

Document System Properties

We've also added a properties command to Document Explorer which allows you to view the system properties of the currently loaded document:

Note that the timestamp (_TS) property is internally represented as epoch time but in the portal experience we've converted the display value to a human readable GMT format.

Document Explorer Filter and Refresh Support

Document Explorer now supports filtering the currently loaded set of documents by the id property. Simply type in the filter box:

 

and the results in the Document Explorer list will be filtered based on your criteria:

 

 Finally, we've added a Refresh command to allow you to easily refresh the documents displayed in Document Explorer:

 Query Explorer

We’re very happy to introduce a new Query Explorer experience which allows you author and run DocumentDB SQL queries.

You can launch Query Explorer from any of the DocumentDB Account, Database, or Collection blades. 
A default query of SELECT * FROM c is provided in the Query Editor:

You can accept the default query or construct your own and then click the Run command to view the results:

By default, Query Explorer will return results in sets of 100. 
If your query produces more than 100 results, simply use the Next page and Previous page commands to navigate through the result set:

Successful queries will provide information such as the request charge, the set of results currently being shown and whether or not there are more results (which can then be accessed via the Next page command in the results pane):

Likewise, if a query completes with errors, the portal will display a list of errors which can help with troubleshooting efforts:

As always, we’d love to hear from you about the DocumentDB features and experiences you would find most valuable within the Azure portal.  Please submit your suggestions on the Microsoft Azure DocumentDB feedback forum.  If you haven’t tried DocumentDB yet, then get started here.

Enjoy!

Stephen Baron
Program Manager