- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
listAndCount Method - Service Factory Reference
This method retrieves a list of records with the total count.
Retrieve List of Records#
If no parameters are passed, the method returns an array with two items:
- The first is an array of the first
15
records retrieved. - The second is the total count of records.
Filter Records#
Parameters#
To retrieve records matching a set of filters, pass an object of the filters as a first parameter.
Returns#
The method returns an array with two items:
- The first is an array of the first
15
records retrieved matching the specified filters. - The second is the total count of records matching the specified filters.
Retrieve Relations#
Parameters#
To retrieve records with their relations, pass as a second parameter an object having a relations
property. Its value is an array of relation names.
Returns#
The method returns an array with two items:
- The first is an array of the first
15
records retrieved. - The second is the total count of records.
Select Properties#
Parameters#
By default, retrieved records have all their properties. To select specific properties to retrieve, pass in the second object parameter a select
property.
select
's value is an array of property names to retrieve.
Returns#
The method returns an array with two items:
- The first is an array of the first
15
records retrieved. - The second is the total count of records.
Paginate Relations#
Parameters#
To paginate the returned records, the second object parameter accepts the following properties:
take
: a number indicating how many records to retrieve. By default, it's15
.skip
: a number indicating how many records to skip before the retrieved records. By default, it's0
.
Returns#
The method returns an array with two items:
- The first is an array of the records retrieved. The number of records is less than or equal to
take
's value. - The second is the total count of records.
Sort Records#
Parameters#
To sort records by one or more properties, pass to the second object parameter the order
property. Its value is an object whose keys are the property names, and values can either be:
ASC
to sort by this property in the ascending order.DESC
to sort by this property in the descending order.
Returns#
The method returns an array with two items:
- The first is an array of the first
15
records retrieved. - The second is the total count of records.