Skip to main content
A data source query can be sorted by a property and/or timestamp and in a given direction. For example, a library data source can be sorted by the “Name of a book” (i.e. property) and in ascending (i.e. direction). Here is an example of a sort on a data source property.
If you’re using the Notion SDK for JavaScript, you can apply this sorting property to your query like so:
Data source queries can also be sorted by two or more properties, which is formally called a nested sort. The sort object listed first in the nested sort list takes precedence. Here is an example of a nested sort.
In this example, the data source query will first be sorted by “Food group” and the set with the same food group is then sorted by “Name”.

Sort object

Property value sort

This sort orders the data source query by a particular property. The sort object must contain the following properties:

Entry timestamp sort

This sort orders the data source query by the timestamp associated with a data source entry. The sort object must contain the following properties: