You can specify pagination options in an optional second argument to the queryNodes function, basically like this:
Chain(branch).queryNodes({
"_type": "video:essentials"
}, {
"sort": {
"title": -1
},
"limit": 10,
"skip": 30
}).then(function() {
...
});
In this example, the results will start at index 30 in the record set and will contain the next 10 entries.
The record set is sorted by "title" in a descending order ahead of being returned.
If pagination sort isn't provided, then the order is not guaranteed. It's really at the discretion of Cloud CMS and the backend implementation may change over time. Thus, sorting is usually a good idea. If you wanted to sort by modification date, you can do this:
"sort": { "_system.modified_on.ms": -1 }The sort model is using MongoDB under the hood so you can utilize dot-delimited syntax to reach into deeply nested properties.
More information is located here: