Working with schema-agnostic queries

The VideoGames1 collection has two documents. The document with id equal to 2 has a platforms key whose value is an array of string with the platforms in which the video game can be executed. The document with id equal to 1 doesn't include the platforms key.

Now we will write a query that will indicate the properties we want to retrieve from all the documents in the collection. Specifically, we will specify we want to retrieve the name and platforms properties. In addition, we will request the results to be sorted by name in ascending order. The code file for the sample is included in the learning_cosmos_db_03_01 folder in the sql_queries/videogame_1_03.sql file:

SELECT v.name, v.platforms FROM Videogames ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.