What's the recommended way to run multiple JSON.SET commands? #2741
Replies: 2 comments
-
await client.json.mSet([{
key: '1',
path: '$',
value: '1'
}, {
key: '2',
path: '$',
value: '2'
}]);
const entries = [{
key: '1',
path: '$',
value: '1'
}, {
key: '2',
path: '$',
value: '2'
}];
await Promise.all(
entries.map(({ key, path, value }) => client.json.set(key, path, value)
);
const entries = [{
key: '1',
path: '$',
value: '1'
}, {
key: '2',
path: '$',
value: '2'
}];
const multi = client.multi();
for (const { key, path, value } of entries) {
multi.json.set(key, path, value);
}
const replies = await multi.exec(); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Excellent!, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear community,
I would like to ask what's the recommended way to run multiple
JSON.SET
commands.Do we have a
multi()
operator for it? I could not find any...I have seen an old thread doing a
Promise.all([])
call to an array ofclient.json.set()
calls. Is this the way to go? I think this way it would not run the commands in a transaction, right?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions