Data queries select the data that form part of a bucket, using the bucket parameters.
Multiple data queries can be specified for a single bucket definition.
Data queries are used to group data into buckets, so each data query must use every bucket parameter.
When specific columns/fields are selected, only those columns/fields are synced to the client.
This is good practice, to ensure the synced data does not unintentionally change when new columns are added to the schema (in the case of Postgres) or to the data structure (in the case of MongoDB).
Note: An id
column must always be present, and must have a text
type. If the primary key is different, use a column alias and/or transformations to output a text
id column.
MongoDB uses _id
as the name of the ID field in collections. Therefore, PowerSync requires using SELECT _id as id
in the data queries when using MongoDB as the backend source database.
Different names (aliases) may be specified for columns/fields:
A limited set of operators and functions are available to transform the output value of columns/fields.
Data queries select the data that form part of a bucket, using the bucket parameters.
Multiple data queries can be specified for a single bucket definition.
Data queries are used to group data into buckets, so each data query must use every bucket parameter.
When specific columns/fields are selected, only those columns/fields are synced to the client.
This is good practice, to ensure the synced data does not unintentionally change when new columns are added to the schema (in the case of Postgres) or to the data structure (in the case of MongoDB).
Note: An id
column must always be present, and must have a text
type. If the primary key is different, use a column alias and/or transformations to output a text
id column.
MongoDB uses _id
as the name of the ID field in collections. Therefore, PowerSync requires using SELECT _id as id
in the data queries when using MongoDB as the backend source database.
Different names (aliases) may be specified for columns/fields:
A limited set of operators and functions are available to transform the output value of columns/fields.