Skip to main content
Version: v4

Sequelize Query info

Overview

The SequelizeQuery argument can be used to specify content selections on queries providing limit, offset, order, group,where and include parameters. As its name implies, it follows the same syntax and implementation as Sequelize ORM

Limit & Offset

FieldDescriptionDocumentation link
limitLimit results to this number of itemshttps://sequelize.org/docs/v6/core-concepts/model-querying-basics/#limits-and-pagination
offsetStart results after this number of itemshttps://sequelize.org/docs/v6/core-concepts/model-querying-basics/#limits-and-pagination

Ordering & Grouping

FieldDescriptionDocumentation link
orderOrder resultshttps://sequelize.org/docs/v6/core-concepts/model-querying-basics/#ordering
groupGroup resultshttps://sequelize.org/docs/v6/core-concepts/model-querying-basics/#grouping

Where & Includes

FieldDescriptionDocumentation link
whereConditionally include resultshttps://sequelize.org/docs/v6/core-concepts/model-querying-basics/#applying-where-clauses
includesConditionally eagerly fetch associated resultshttps://sequelize.org/docs/v6/advanced-association-concepts/eager-loading

Supported operators

The following operators are supported for advanced where or includes settings

OperatorDescription
$gtGreater than
$gteGreater than or equal to
$ltLess than
$lteLess than or equal to
$notNot
$overlapDatabase array and provided array have values that overlap (in common)
$containsDatabase array contains provided element or array
$andAnd
$orOr
$likeCase sensitive pattern matching
$iLikeCase insensitive pattern matching
$notLikeCase sensitive exclusive pattern matching
$notILikeCase insensitive exclusive pattern matching

Advanced reading

Operator operation building

Due to the requirement for escape characters becoming very fiddly at larger scales it is advised that you write your advanced where queries as javascript objects and double stringify them to get the escape characters. You can also use the tool below to do this for you.

Operator example

This example searches for posts that have start the day anywhere in either the title or description (Where section) and who's post parent includes one of the specified meditation categories (Includes section).