Sign In Register

How can we help you today?

Start a new topic

skip query results when querying gamedata type

There's a limit on number of results returned by query on gamedata type. So if there are more than 100 results how can we query the data and skip first 100 results?

2 people have this question

has anyone come up with a solution to this?

seems like it won't be possible to adopt Game Data Service and we will have to continue to use Mongo unless this limitation is lifted.

Did any genius come up with a legit work around?

One idea I have in mind: give every single entry to your data type table an integer value that is incremented from the previous entry, starting from 0.

Imagine you have a card game and have a DataType representing a card, like in the Hearthstone example.

So all entries in the "Cards" table have an integer value, 0, 1, 2, 3.

Now, you can query based on this ID, the first 0-100 cards, 101-200, 201-300, etc.

I think this really sucks badly, but at least it would allow it to work.

Would only work on meta collections though, as generating the IDs would have to be done before hand, probably manually.

Dunno how you can safely generate a unique integer ID sequentially otherwise using GameSparks.

Hey Drew,

The method you mentioned is also applicable on Game Data service and not only on meta collections.

You can use something like a redis counter, Or a custom Unique Id generator.

You can then index that field and use pagination using <greater than query> in case of redis counter and <greater than> along with <sort > in case of Unique Id generator.

Even better you can insert a field createdAt with timestamp. 

Here is a custom uuid generator:-

function uuid(a){
    return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,uuid);


1 person likes this
Login to post a comment