Returning Values

Sort

Sorts the results by the specified keys.

.sort(keys)

Since v0.3.0

Once - This can only be used once.

Accepts a single key or an array of keys.

Sorts the results by the specified keys.

Prefixes:

  • -: Descending order.
  • +: DEFAULT. Ascending order.

Macros:

const query = pbQuery<Post>()
  .sort(['title', '-created'])
  .build(pb.filter);

console.log(query.sort) // Output: 'title,-created'