From the course: Azure Cosmos DB: SQL API Deep Dive

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Solution: JavaScript programming

Solution: JavaScript programming

From the course: Azure Cosmos DB: SQL API Deep Dive

Start my 1-month free trial

Solution: JavaScript programming

(upbeat music) - [Instructor] In this challenge, you are asked to create a programmatic construct that could expand to SQL query language so that your company can quickly implement a 20% overhead without changing existing data. To solve this problem, I created a user-defined function or UDF. I then implemented some simple JavaScript logic to manipulate the number that is passed into the function and return the result. The logic I implemented is shown right here on the slide. Finally, I invoke the UDF in a query. I call in the function using the UDF dot function name syntax shown here. We will look at this syntax a little bit more in example. Let's go into the Azure portal and find our Azure Cosmos DB resource. Once we click the resource, we'll be directed to the resource blade. From here, we can select the data explorer to return and manage our JavaScript code. We're going to go into our database and then our collection…

Contents