diff --git a/src/database/redis/hash.js b/src/database/redis/hash.js index d5636cdfe7..f615c989c5 100644 --- a/src/database/redis/hash.js +++ b/src/database/redis/hash.js @@ -75,7 +75,7 @@ module.exports = function (module) { if (cachedData[key]) { return cachedData[key].hasOwnProperty(field) ? cachedData[key][field] : null; } - return await module.client.async.hget(key, field); + return await module.client.async.hget(key, String(field)); }; module.getObjectFields = async function (key, fields) { diff --git a/test/database/hash.js b/test/database/hash.js index 8d94a23b6b..d3a5535d5d 100644 --- a/test/database/hash.js +++ b/test/database/hash.js @@ -211,6 +211,11 @@ describe('Hash methods', function () { done(); }); }); + + it('should return null and not error', async () => { + const data = await db.getObjectField('hashTestObject', ['field1', 'field2']); + assert.strictEqual(data, null); + }); }); describe('getObjectFields()', function () {