# Fetch limited data from database

**URL:** <https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399>\
**Category:** Game Design\
**Created:** [February 25, 2021, 3:07pm UTC](https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399 "2021-02-25T15:07:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmsudhir](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@kmsudhir](https://forum.heroiclabs.com/u/kmsudhir)\
**Post date:** [February 25, 2021, 3:07pm UTC](https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399/1 "2021-02-25T15:07:46Z")

</div>

how to get limited data from database and rest data on next call of rpc (means how to implement pagination on data). i am using lua for server side scripting in nakama.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 25, 2021, 4:33pm UTC](https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399/2 "2021-02-25T16:33:59Z")

</div>

@kmsudhir The storage engine already provides an API which returns a cursor which can be used to fetch the follow on page of results. This is a pattern we use across all the server APIs.

- [Collections - Nakama server](https://heroiclabs.com/docs/storage-collections/#list-objects)
- [Function Reference - Nakama server](https://heroiclabs.com/docs/runtime-code-function-reference/#storage)

---

<div class="post-metadata">

**Author:** ![kmsudhir](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@kmsudhir](https://forum.heroiclabs.com/u/kmsudhir)\
**Post date:** [February 25, 2021, 4:51pm UTC](https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399/3 "2021-02-25T16:51:08Z")

</div>

thanks for quick reply but i need to use this cursor with friend list. please suggest how to use with the friendlist.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 26, 2021, 12:26pm UTC](https://forum.heroiclabs.com/t/fetch-limited-data-from-database/1399/4 "2021-02-26T12:26:17Z")

</div>

@kmsudhir I don’t understand your use case. If you want to page over friends on the server-side there’s already a Server Framework function to do that which returns a cursor. If you want to page over results in a storage collection that is covered in the documentation I linked above.
