Skip to content
New issue

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

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

Already on GitHub? # to your account

data type is changing between .hset() and .hget() #727

Open
eakl opened this issue Jul 20, 2024 · 0 comments
Open

data type is changing between .hset() and .hget() #727

eakl opened this issue Jul 20, 2024 · 0 comments

Comments

@eakl
Copy link

eakl commented Jul 20, 2024

.hget() does not return the type that has been set with .hset()

await kv.hset(`key`, { code1: '123456', code2: '000001' }) // code is a string
const value = await kv.hgetall(`key`)
console.log(typeof value.code1) // code is a number
console.log(typeof value.code2) // code is a string

With automaticDeserialization: false as mentioned here: #250

console.log(typeof value) // value is an 'object'
console.log(typeof value.code) // code is undefined
console.log(typeof JSON.parse(value)) // is not a valid JSON
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant