Skip to content

SendCommand hGetall return format changed from v3 to v4 #2038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
linnerissa opened this issue Mar 16, 2022 · 2 comments
Open

SendCommand hGetall return format changed from v3 to v4 #2038

linnerissa opened this issue Mar 16, 2022 · 2 comments
Labels

Comments

@linnerissa
Copy link

in v3, calling send_command with hGetall command would result in a return of format

{
    "key1": "value1",
    "key2": "value2",
}

in v4, sendCommand with "hGetAll" returns ["key1", "value1", "key2", "value2"]. This seems like a breaking change between the versions that wasn't listed

Seems like running client.HGETALL however returns in object format. Is there a method to coerce the sendCommand return to be formatted correctly?

Environment:

  • Node.js Version: 16.13.2
  • Redis Server Version: Redis 6.2.6
  • Node Redis Version: 4.0.4
  • Platform: MacOS 12.1
@linnerissa linnerissa added the Bug label Mar 16, 2022
@MatanYemini
Copy link
Contributor

"Behind the scenes" if you will run hgetall it will return this ["key1", "value1", "key2", "value2"] - so basically running this directly will give you this result.
I would just recommend using the wrapped function that is part of this lib.

@jhavok86
Copy link

Ran into this issue as well. I switched to using the wrapped function but the results still return as an array. This seems to only happen when legacyMode = true. If I do not use legacyMode then results return as expected.

leibale added a commit that referenced this issue Jan 18, 2023
…red to v3 results (#2367)

* Ensure that transformReply is optionally passed through to commands in legacy mode within multi

* Execute transformReply on legacy #sendCommand

* Scope transform changes to hGetAll

* Extensible method of transforming legacy replies, expands RedisCommand interface

* check `TRANSFORM_LEGACY_REPLY` on client creation (rather then on command exec), add tests

Co-authored-by: Leibale Eidelman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants