Let's query our data using SQL query structure:
- Click on the New SQL Query button and paste this query:
SELECT * FROM Families f WHERE f.id = "100"
- This will yield the following result:
[{ "id": "100", "lastName": "Doe", "parents": [ { "firstName": "John" }, { "firstName": "Mary"} ], "children": [ { "firstName": "Emily", "gender": "female", "grade": 5, "pets": [{ "givenName": "Fluffy" }] } ], "address": { "state": "WA", "county": "King", "city": "seattle" }, "creationDate": 1431620472, "isRegistered": true }]
- You can also execute a traditional order by queries, similar to the following one:
SELECT c.givenName FROM Families f JOIN c IN f.children WHERE f.id = '200' ORDER BY f.address.city ASC
- This will yield the following result:
[ { "givenName": "Jesse" }, { "givenName": "Lisa"} ]
- You can also run the sub-queries, that is, get the subdocuments from the main document. You can refer to the following query:
SELECT * FROM Families.children
- This will yield the following result:
[ [ { "firstName": "Emily", "gender": "female", "grade": 5, "pets": [ { "givenName": "Fluffy" } ] } ], [ { "familyName": "Merriam", "givenName": "Jesse", "gender": "female", "grade": 1 }, { "familyName": "Miller", "givenName": "Lisa", "gender": "female", "grade": 8 } ] ]
So, we now know how to create and query documents. Let's perform an UPDATE and DELETE operation.