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 v ORDER BY v.name
Â
You can follow the steps to execute the preceding query:
- Go to Azure Storage Explorer and navigate through the existing document database (
Competition
), its collection (VideoGames1
), and itsDocuments
element by expanding and...