Get Storage By User Id

In the Nakama console, you can filter/search Storage collections by User Id but there doesnt appear to be a way to do this at runtime using any of the existing API endpoints/RPCs?

Looking at the console source, I see that the console uses SQL to achieve this filtering:

I know that using direct SQL in custom RPC functions is discouraged in many cases, but is this going to be our only way of achieving the end result in this case?

TIA!

Hello @sedmonds,

Fetching all storage objects per user is not ideal since an account may have many objects. The Storage Engine is not optimized for this use case and may perform poorly at scale. An exception is made in the Console as the query is expected to be executed seldom as opposite to the runtime and client-facing APIs.

Ideally you should know which objects you need by user, collection and key and load them when appropriate, or use the storageList API to traverse a collection.

Best.

1 Like