Closed jqyu closed 7 years ago
Redis values are serialized as strings, and as such nulls are typically stored as the empty string. Thus, when retrieving specific properties, nulls will be deserialized incorrectly:
https://github.com/bustlelabs/radredis/blob/master/src/index.js#L268-L270
import radredis from 'radredis' const Model = radredis({ foo: { type: 'integer' }, bar: { type: 'integer' } }) Model.create({ foo: 123 }) .then(() => Model.find(1, [ 'foo', 'bar' ])) // => { foo: 123, bar: NaN }
Problem lies in the fact that calling an hmget returns empty strings, not undefined
hmget
undefined
Redis values are serialized as strings, and as such nulls are typically stored as the empty string. Thus, when retrieving specific properties, nulls will be deserialized incorrectly:
https://github.com/bustlelabs/radredis/blob/master/src/index.js#L268-L270
Problem lies in the fact that calling an
hmget
returns empty strings, notundefined