These mirror ember data methods. They are high level and aim to be useable by the API via the url query string etc. They follow jsonapi spec where appliable. They are:
this.store.findAll('post') // returns all posts
this.store.query('post', {
include: 'comments, author',
fields: {
post: 'title',
comments: 'comment',
author: 'firstName, lastName'
},
sort: '-title',
page: {number: 1, size: 20},
filter: {
title: {$like: '%tips for%'},
id: {$gt: 10}
}
}) // returns posts based on various criteria
this.store.findRecord('post', 1) // returns a single post by id
this.store.queryRecord('post', options) // returns a single query, otherwise same as .query
This is a single method that allows for building more advanced queries.
This type of querying allows for more advanced scenarios querying accross multiple tables via joins etc while still allowing Ash to help you out by building model objects from the returned data for you.
Eg.
this.store.modelQuery('post')
.leftJoin('author', 'post.author_id', 'author.id')
.where('author.first_name', 'Jo')
There will undoubtedly be scenarios that fall outside the scope of full ORM queries or even the more advanced modelQueries. This single method allows for building raw sql queries that will return the raw data for you to handle as you like.
this.store.rawQuery('SELECT * FROM post WHERE title = ?', ['My Post Title'])