Skip to main content

List

List Resources

This entrypoint returns a set of resources.

  • GET /{base_url}

Parameters

NameTypeInDescriptionDefault
limitnumberqueryThe maximum number of documents1000 (max)
pagenumberqueryThe page number of documents; starts from 11
include_permissionsbooleanqueryWhether to include document permissionstrue
include_countbooleanqueryWhether to include total results countfalse
skimbooleanqueryWhether to bypass Document-level permissions checksfalse

Example

request

curl \
-H "Accept: application/json" \
https://example.com/users?limit=100&page=5&include_permissions=false&include_count=false

response

Status: 200
[
{
"name": "Andrew Jackso",
"address": "5d6ede6a0ba62570afcedd3a",
"role": "user",
"creditBalance": 100,
"loginDate": "2022-02-22T02:02:22.679Z"
}
]

List Resources - Advanced

This entrypoint returns a set of filtered resources that includes selective data fields.

  • POST /{base_url}/__query
  • The suffix __query can be configured using a model option, as demonstrated below:
    modelRouter.set('queryPath', '_queryable_');

Parameters

NameTypeInDescriptionDefault
filterobjectbodyMongoose Filter object
selectobject │ array[string]bodyDocument fields to include or exclude
populatearray[string] │ array[object]bodyDocument fields to populate
sortstring │ objectbodyDocument sort order
skipnumberbodyThe number of documents to skip; used over page if specified
limitnumberbodyThe maximum number of documents; used over pageSize if specified1000 (max)
pagenumberbodyThe page number of documents; starts from 11
pageSizenumberbodyThe maximum number of documents1
options.includePermissionsbooleanbodyWhether to include document permissionstrue
options.includeCountbooleanbodyWhether to include total results countfalse
options.populateAccess'list' │ 'read'bodyThe access level to use in populate methodread

Example

request

curl \
-X POST \
-H "Accept: application/json" \
https://example.com/users/__query \
-d '{
"filter": { "loginDate": { "$gte": "2022-02-22T02:02:22.679Z" } },
"select": ["name", "address"],
"populate": ["address"],
"sort": { "createdAt": -1 },
"limit": 100,
"page": 5,
"options": {
"includePermissions": true,
"includeCount": true,
"populateAccess": "list"
}
}'

response

Status: 200
{
"count": 2,
"rows": [
{
"_id": "5d6ede6a0ba62570afcedd3a",
"name": "Mike",
"address": {
"city": "Seattle",
"country": "USA"
},
"_permissions": {
"edit": true
}
},
{
"_id": "5d6ede6a0ba62570afcedd3b",
"name": "Jennifer",
"address": {
"city": "Vancouver",
"country": "Canada"
},
"_permissions": {
"edit": false
}
}
]
}