I’m building a game where each user submits some data from the client to the server. I’m saving this data in Postgres. Once all the players are “ready” in my lobby, I would like to go and pick a random piece of data that was previously submitted by one of my players. However, I’m having trouble to grab all the data from a given collection from the server. I can only read the data to the latest user to call the MatchLoop. As part of the object that I am storing I have a property called “shown”, I would love some help on how to filter for not shown image from the entire collection.
- Versions: Nakama 3.15.0, Windows| Docker, GitHub - heroiclabs/nakama-common: The runtime framework for Nakama server. v1.26.0
- Server Framework Runtime language (If relevant) Go
// Tried not specifying key of userid to read all records from the collection but did not get any data back
objectIds := []*runtime.StorageRead{
&runtime.StorageRead{
Collection: "images",
},
}
// I am currently just reading whatever the last image I get from the latest user to hit MatchLoop
objectIds := []*runtime.StorageRead{
&runtime.StorageRead{
Collection: "images",
Key: matchID,
UserID: userID,
},
}
objects, err := nk.StorageRead(ctx, objectIds)
// I'm sending a base 64 of the image from the client directly to the database this is my JS code
// Upload base64 image to database directly from client
await ctx.client.writeStorageObjects(ctx.session, [
{
"collection": "images",
"key": matchId,
"value": data,
}
]).then(async _ =>
//....
);
Media: