By Stephen Garside on 12/1/2017
I have recently had the opportunity to use Cosmos DB in Microsoft Azure for a project , so have started to pull together a cheat sheet for all the different things I find out on my travels - hope you find it useful!
SELECT * FROM c WHERE CONTAINS(c.id, "RK0305500")
SELECT * FROM c WHERE ENDSWITH(c.id, "_somestring")
SELECT * FROM c WHERE CONTAINS(c["Product Level"], "Level 1")
SELECT VALUE COUNT(1) FROM c
In the example below, 'parent' is the parent item, and 'ChildProducts' is an array of properties off each parent. These child arrays hold the 'Some Property Name' property.
SELECT child["Some Property Name"] FROM parent JOIN child IN parent.ChildProducts WHERE parent.id = "Some Id"
SELECT VALUE parent FROM parent JOIN child IN parent.ChildProducts WHERE child.id= "some id"