November 2018
Intermediate to advanced
606 pages
15h 7m
English
If you think about SQL, you probably see a relational database with tables, relations, and stored procedures. When working with SQL API in Cosmos DB, in fact you will work with documents that can be queried using the SQL syntax. Let us assume you want to query documents using the following call:
SELECT * FROM dbo.Order O WHERE O.AccountNumber = "0000-12-223-12"
Here you can find an example of a query written in C#:
var order = client.CreateDocumentQuery<Order>(collectionLink) .Where(so => so.AccountNumber == "0000-12-223-12") .AsEnumerable() .FirstOrDefault();
As you can see, it is all about a simple LINQ query, which allows you to use a specific property to filter data. Because all records in Cosmos DB are stored as JSON documents, ...