# Find storage object by value

**URL:** <https://forum.heroiclabs.com/t/find-storage-object-by-value/3747>\
**Category:** Runtime Framework\
**Created:** [April 4, 2023, 6:32am UTC](https://forum.heroiclabs.com/t/find-storage-object-by-value/3747 "2023-04-04T06:32:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gruset](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/gruset/32/940_2.png) [@gruset](https://forum.heroiclabs.com/u/gruset)\
**Post date:** [April 4, 2023, 6:32am UTC](https://forum.heroiclabs.com/t/find-storage-object-by-value/3747/1 "2023-04-04T06:32:16Z")

</div>

Hello! I do have 3 quick questions that i would love to have answered! 🙂

1. It seems that its not possible to get a storage object by value, this is correct right?

2. Can i, within the go framework retrieve a record linked to a specific userId as the server user? or do i need to know the userId of that record to be able to get it out of the database? I really dont want to change so that the userId is set to servers id.

3. Is it possible, in any way, to get the match state in a rpc call? This is something that i really want. Currenly building a friend system (this is not suitable in my casehttps://heroiclabs.com/docs/nakama/concepts/friends/) and id like to know if any of the friends is online atm. Benefits of using rpc as far as i know is that you can send and wait for a response instead of getting friendlist in sending a as an action state (as you do in moving the player etc).

Best regards  
/g

---

<div class="post-metadata">

**Author:** ![dela](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/dela/32/1489_2.png) [@dela](https://forum.heroiclabs.com/u/dela)\
**Post date:** [April 4, 2023, 7:48am UTC](https://forum.heroiclabs.com/t/find-storage-object-by-value/3747/2 "2023-04-04T07:48:38Z")

</div>

1: i’m not aware of a functionality for this. Imagine you want to get an image “sample.jpg” which you can do. But you can not query the “image with the most red pixels”

2: have you tried querying with an empty/nil userId? the server framework should be able to get all storage objects. (can’t confirm though)

3:  
i recently build an administration site and needed to access match state. You can use [matchSignal](https://heroiclabs.com/docs/nakama/server-framework/go-runtime/function-reference/match-handler/#MatchSignal) to interact with the match/state. Note that this call is processed in the matchLoop. So it’s answer time is directly related to your tickRate (if i understand this correctly. I can only talk for JS runtime, maybe go is better?)

In my case i send payload “peek” and return the current ticks and state.

```ts
const matchSignal: nkruntime.MatchSignalFunction<ServerMatchState> = (ctx, logger, nk, dispatcher, tick, state, data) => {
  if (data == 'peek')
    return {
      state,
      data: JSON.stringify({
        tick,
        state
      }),
    };

  return {
    state,
    data: ''
  }
};

```

If you want to see which users are actually in **any** match, you are probably better using matchLabels, which are far easier queryable, and probably faster then signaling all running matches.

---

<div class="post-metadata">

**Author:** ![gruset](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/gruset/32/940_2.png) [@gruset](https://forum.heroiclabs.com/u/gruset)\
**Post date:** [April 4, 2023, 8:15am UTC](https://forum.heroiclabs.com/t/find-storage-object-by-value/3747/3 "2023-04-04T08:15:20Z")

</div>

Thank you for ur reply!

Ill try querying using an empty id. I agree that the server should be able to get a record no matter what userid its user id is set to.

I’ll look into match signals and see if its viable! Thanks!
