ChatiumFor developersPlaygroundPricing
Sign in

HeapTableRepo.findBy

Returns an array of heap objects with the specified filtering.

This method is syntactic sugar for findAll in cases where only the composition of the result set matters, but not the order and number of records.

If no filtering is specified, all records from the table are returned.

The maximum number of records that this method can return is 1000. If you need to retrieve more records, you should use findAll with the limit and offset parameters.

Usage/Signature

table.findBy(ctx, where)
  • Arguments

    • ctx*: app.Ctx
      The request context. Used for internal implementation and also allows executing the query in the desired transaction.
    • where: HeapFilter
      An object with filtering conditions in a special language.
  • Return Value: Promise<HeapObject[]>

    • An array of heap objects that match the filtering conditions.

Examples


Fetching all records with a priority greater than 3 and a title containing the substring 'important'.

const Tasks = Heap.Table('tasks', {
  title: Heap.String(),
  priority: Heap.Integer(),
})
const importantTasks = await Tasks.findBy(ctx, {
  priority: { $gt: 3 },
  title: { $ilike: '%important%' },
})