Using built-in array functions

The previous query made sure that it only processes each videogame document that has a level property defined at the root level and its value is an array. However, it is possible to have a new videogame document that declares an empty array ([]) as the value for the level property because the video game doesn't have defined levels yet.

The next query is a new version of the previous query that takes advantage of the ARRAY_LENGTH built-in function. This function returns the number of elements of the array expression received as an argument. The query makes sure that the level property is an array and that it contains at least one element. The results for the query will be the same that were shown for its previous ...

Get Guide to NoSQL with Azure Cosmos DB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.