I have a code like this,
function generateJsonPaths(ids) {
const idsString = _.map(ids, id => `"${id}"`).join(',')
return `$.orgs.[${idsString}]`
}
const redisMulti = redisClient.multi()
const path = generateJsonPaths(ids)
_.each(hashes, hash => redisMulti.json.get(hash, { path }))
const jsonCache = await redisMulti.exec()
When there is non existent id, I get an error as Unexpected token E in JSON at position 0, and the whole multi function fails. In the redis terminal though I could do something like this, json.get key $..id1 $..id2 and I get empty array for non existing values. Is there a way to replicate this value in this package?
Environment:
Node.js Version: 14.20 Redis Server Version: 6.2.6 Node Redis Version: 4.3.0 Platform: Mac OS 11.6.8