Arcade-style leaderboards

Here described arcade-style leaderboards - where a single user posts multiple entries - by setting the entry’s id to a combination of the user’s ID and a current Unix time (e.g., <user-id>:<unix-time>).

But i can’t understand how to use this feature. Code:

let record = nk.leaderboardRecordWrite(FINISHING_MINI_QUEST_LEADERBOARD_ID, `${ctx.userId}:${Date.now()}`, '', 3);

throws an error expects owner ID to be a valid identifier

How can i fix this?

When creating a leaderboard entry from the server code with leaderboardRecordWrite second argument should be valid owner id. <user-id>:<unix-time> key can go to the third argument, which is doesn’t have such requirement.

third argument is username, i’ve tried user name like <user-id>:<unix-time>, but nothing changes - only one record per user

Just to clarify my understanding what you see.

  1. you are making multiple calls to leaderboardRecordWrite with same leader board id, same owner id , but differnt usernames.
  2. Then when you fetch leaderboard with leaderboardRecordsList passing same leaderboard id and owner id you get just one entry back?
  1. Yes
  2. No, i’m using nakama console
  1. leaderboardRecordsList result
{
  "nextCursor": null,
  "prevCursor": null,
  "records": [
    {
      "leaderboardId": "fishing_mini_quest",
      "ownerId": "d99ddc6b-9c0f-437a-9901-21d6bec79a0b",
      "createTime": 1660554021,
      "updateTime": 1660558921,
      "expiryTime": 1661126340,
      "rank": 1,
      "username": "d99ddc6b-9c0f-437a-9901-21d6bec79a0b:1660558921380",
      "score": 1,
      "subscore": 0,
      "numScore": 3,
      "maxNumScore": 1000000,
      "metadata": {}
    }
  ],
  "ownerRecords": [
    {
      "maxNumScore": 1000000,
      "createTime": 1660554021,
      "updateTime": 1660558921,
      "expiryTime": 1661126340,
      "score": 1,
      "subscore": 0,
      "username": "d99ddc6b-9c0f-437a-9901-21d6bec79a0b:1660558921380",
      "numScore": 3,
      "metadata": {},
      "rank": 1,
      "leaderboardId": "fishing_mini_quest",
      "ownerId": "d99ddc6b-9c0f-437a-9901-21d6bec79a0b"
    }
  ]
}