From df52a4ba7133b03ce784889cce266d2ab3b602ca Mon Sep 17 00:00:00 2001 From: Yonghong Ren Date: Mon, 11 Feb 2019 17:05:04 -0500 Subject: [PATCH] unstringify on read. When a model's field has no property definition, we unconditionally stringify the field on write. If the field data is a string, it gets quoted again. On read we don't undo the stringification. A string data field becomes a string with extra quotes. read & write need be symmetrical. --- lib/redis.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/redis.js b/lib/redis.js index fb554c8..80e1c43 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -273,7 +273,10 @@ BridgeToRedis.prototype.fromDb = function(model, data, fields) { delete data[i]; continue; } - if (!p[i]) continue; + if (!p[i]) { + data[i] = JSON.parse(data[i]); + continue; + } if (!data[i]) { data[i] = ''; continue;