mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
fix: redis hget
'node_redis: The HGET command contains a invalid argument type.\n' + 'Only strings, dates and buffers are accepted. Please update your code to use valid argument types.'
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user