Queries

Queries allow the user to search for models of interest. Queries are initiated from the ModelService via the query() method. The method takes an options objects that will refine the query to narrow the result set. An example query might look something like this:

const query = modelService.query({
  collection: "employees",
  limit: 10,
  offset: 20,
  orderby: {
    field: "lastName",
    ascending: true
  }
}).then(results => {
  results.forEach(result => console.log(result));
});

The query() method asynchronously returns the set of models matching the query via a promise. The result of the query is an array of ModelResult objects which contain metadata describing the matching models. Each object contains the matched model's collectionId and modelId, allowing you to open if so desired.

results matching ""

    No results matching ""