query (modelName, query) Promise
This method delegates a query to the adapter. This is the one place where adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query language for all server-side queries, and then require all adapters to implement them.
If you do something like this:
store.query('person', { page: 1 });
The call made to the server, using a Rails backend, will look something like this:
Started GET "/api/v1/person?page=1" Processing by Api::V1::PersonsController#index as HTML Parameters: { "page"=>"1" }
If you do something like this:
store.query('person', { ids: [1, 2, 3] });
The call to the server, using a Rails backend, will look something like this:
Started GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3" Processing by Api::V1::PersonsController#index as HTML Parameters: { "ids" => ["1", "2", "3"] }
This method returns a promise, which is resolved with an AdapterPopulatedRecordArray
once the server returns.
Parameters:
-
modelName
String
-
query
Any
- an opaque query to be used by the adapter
Returns:
-
Promise
- promise
Please login to continue.