Queries And Masks
In the last section, we have seen how to work with remote objects, but: What about doing queries to the database?
Sometimes our app’s workflow will need to check some data, for example:
Database: give me all chat rooms where the logged user appears
And then print all these chats in a list.
Let’s see how simple is querying data.
Imagine we have a database called myDatabase
where we store chat rooms.
What are we seeing here?
The first parameter is the database name where we will look for data: myDatabase
The second parameter is the path where data should exist: /chats/*
The third parameter is the query:
The fourth parameter is the mask, which will refactor the response:
Result
Query method will always return a list of results. In this case (with a mask) the response will be:
If we don’t define a mask, the result will be: