Defining queries
Data in Triplit is organized into collections, so to define a query you must first specify which collection you want to query.
For example, if you want to query the users
collection, you would write the following:
const query = client.query('users');
Using queries
This query object is a builder that allows you to specify (and then reuse) a query. To fetch data you must use a method like fetch
or subscribe
, or if you're using a query in a frontend component, you can use one of the Triplit-provided hooks.