Azure DocumentDB Adds JavaScript Language Integrated Queries

Microsoft is continuing to build on it’s cloud based document database designed for web applications and today is announcing support for JavaScript Language Integrated Queries.

Azure DocumentDB’s database engine is purposefully designed from the ground up to provide first class support for JSON and JavaScript. Our vision is for JavaScript developers to build applications without having to deal with the entity mappers, schemas, code generation tools, type adornments and other duct tapes.  — Azure Blog

Azure DocumentDB allows developers to store data in native JSON format and then perform queries on that data including using stored procedures.  The diagram below shows how JSON data is stored in Azure DocumentDB

 

The query for all “exports” from documents with the headquarters of Belgium previously looked like this.

function() {
 var filterQuery = 'SELECT * from companies c where c.headquarter = "Belgium"';
 var isAccepted = <strong>.queryDocuments(</strong>.getSelfLink(), filterQuery,
 function(err, docs, options) {
 if (err) throw new Error(err.number + err.message);
 __.response.setBody(docs);
 });
 if (!isAccepted) __.response.setBody('Query timed out');
}

But with JavaScript Language Integrated Queries, that same query can be expressed with this syntax.

function() {
 var resp = __.filter(function(company) {
 return company.headquarter == 'Belgium';
 });
 if (!resp.isAccepted) __.response.setBody('Query timed out');
}

For more information on this announcement including a SQL to JavaScript Query API Cheat Sheet, visit the Azure Blog.

Rachel Snowbeck

Recent Posts

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

7 days ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

3 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago

Mastering Compliance: The Definitive Guide to Managed Compliance Services

In the intricate landscape of modern business, compliance is both a cornerstone of operational integrity…

2 months ago