Learn Azure Cosmos DB in 7 days (2)

Today, I used a little less than three hours on learning. But, I did gain quite experience about it and fell in love with this process—-the process of learning with the purpose to blog (brag)

What I did & How I did itWhat I find out
Copied Pasted simple Jason into document
I followed the instruction of
this page, Add Sample Data session. I pasted more than once, made changes and save more . I also pasted sample data on
this page
It is required to change id in order to save successfully, which is understandable, as id is the primary key and you can not have duplicate primary key. But, how could large scale data satisfy this requirement?
Queried data that I pasted with query examples on mentioned pages
SELECT * FROM c ORDER BY c._ts DESC


SELECT *
FROM Families f
WHERE f.id = "WakefieldFamily"
I don't understand where "c" and "Family" come from. At the beginning, I thought "c" means collection. But, I eventually find out you can use any word in the place of "c" and "Family". I tried "all", "really", and it give the same result. Strange.
For every document/record, system will add five properties like this:
"_rid", "_self", "_etag", "_attachments", and "_ts".
Have you noticed that these properties start with "_"
Played more queries

SELECT c.givenName
FROM Families f
JOIN c IN f.children
WHERE f.id = 'WakefieldFamily'
ORDER BY f.children.grade ASC

This query is on second page I mentioned above
I did not get the result expected. I got "Results: 0 - 0"
I tried more variety and deeper into the property hierarchy like c.children.grade and I did not get anything. I will learn more NoSQL SQL later 🙂
Built the web app as directed on this page:
https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-dotnet
Following the instruction is not hard and seeing the result webpage is rewarding
Then, I tried add data on web app and see it appeared on Data Explorer on Azure and vise versa
I can add "completed" record/document onto the document list from both web app and azure portal. But, the data did not show on web app.
the edit/details/delete link on the web app is broken and gives me an error page

I am happy so far and can not wait for tomorrow.

Leave a Reply

Your email address will not be published. Required fields are marked *