Skip to main content

Return results immediately

Return results immediately in the JSON DB


return results immediately in the json db

Most actions return results as a set of records. By default, a response message returns up to 20 records in the "data" property. This protects against accidentally returning a vast number of records. To return more records, you can add "maxRecords" to your request message and set it to your desired number. This causes the response message to return as many records as it can up to the maximum number you specify. If you want to return all possible records, set "maxRecords" to -1.

If you want to skip over some records, you can optionally set "skipRecords" to the number of records to skip. To reverse the sort order of the results, you can optionally set "reverseOrder": true.

Immediately returning results works best when the resultset is small. When a resultset is large, it is best to paginate over the results by returning a different subset of records each time you call an action. This is possible using the "skipRecords" and "maxRecords" properties, but it is inefficient because it reruns the action each time you call it.

When you want to paginate over a resultset, you should return a cursor instead of a resultset. You can do this by setting the "returnCursor" property to true.  The "skipRecords", "maxRecords", and "reverseOrder" properties are completely ignored when returning a cursor. For more information, see Using cursors.

Example 1. Default values


You can omit any of these properties when you want to use the default value.

  "returnCursor": false,
  "skipRecords": 0,
  "maxRecords": 20,
  "reverseOrder": false,

Example 2. Request message that skips the first 40 records and returns the next 20 records


This example illustrates the inefficient pagination technique to show these properties in action. It is best to return a cursor instead.

  "requestId": "1",
  "action": "getRecordsByPartialKeyRange",
    "databaseName": "myDatabase",
    "tableName": "persons",

    "returnCursor": false,
    "skipRecords": 40,
    "maxRecords": 20,
    "reverseOrder": false,

      "indexName": "NameOfIndex",
      "partialKey": "Mi" 

    "apiVersion": "1.0",
    "authToken": "anAuthorizationTokenFromTheServer"