Need whole value column on "nk.StorageIndexList"

When I use this method, as part of the value, it only returns the queried field. So I need to again call “nk.StorageRead” to get the whole value. However, it’s certainly not a performant approach. It’s much simpler to get the whole data on the query.

this is my example:

func queryListModeled[T any](indexName string, query map[string]string, nk runtime.NakamaModule, ctx context.Context, logger runtime.Logger, order []string, limit int, callerId string) ([]T, bool) {

	finalQuery := queryHelper.MapToQueryString(query)
	data, err := nk.StorageIndexList(ctx, callerId, indexName, finalQuery, limit, order)

	var result []T
	if err != nil || len(data.Objects) == 0 {

		logger.Error("nakama storage read error: %v", err)
		return result, false
	}

	for _, item := range data.Objects {
		var data T

		keys := []*runtime.StorageRead{
			{
				Collection: item.Collection,
				Key:        item.Key,
				UserID:     item.UserId,
			},
		}

		storageReadResult, readError := nk.StorageRead(ctx, keys)

		if readError != nil || len(storageReadResult) == 0 {

			logger.Error("nakama storage read error: %v", err)
			return result, false
		}

		err = json.Unmarshal([]byte(storageReadResult[0].Value), &data)

		if err != nil {
			logger.Info("nakama unmarshal error:", err)
		}
		result = append(result, data)

	}

	return result, true

}

@virtouso are you registering the index with indexOnly set to true? Because if that’s set to false, then the returned objects from the index’s List operation will contain the full value of the hits.

indexOnly is a very specific performance optimization that you likely don’t need, so I’d suggest you switch it to false.

Best.