Open uglide opened 1 year ago
@leibale JSON.MGET
is a different beast compared to MGET
. We don't know the key of documents where the path
return us any results. That's why it's helpful to have a high-level wrapper that merges results from all primaries.
Then we need a wrapper like in Graph... executing client.ft.search
(or any other command) should be as close as possible to the redis-cli
version (with some "type mapping"). "Automagically" running multiple commands when the user executed only one feels wrong.
@chayim @itamarhaber @guyroyse @simonprickett WDUT?
Idk about the implementation, but I'm just saying that where a command should run is a part of the command's docs and modules should use the same API: https://redis.io/docs/reference/command-tips/#request_policy
so something like
const REQUEST_POLICIES = {
...
};
const RESPONSE_POLICES = {
...
};
// will default to the policy defined in redis
cluster.ping();
// can be overridden
cluster.withPolicy({
request: ...,
response: ...
}).ping();
Motivation
The Cluster client should provide overrides for specific Redis Core and module commands to make them easy to use with OS Cluster API.
FT.AGGREGATE
and executesFT.CURSOR READ
orFT.CURSOR DEL
on the correct node (on the node where FT.AGGREGATE was executed) automaticallyconst cluster = createCluster({ rootNodes: [ // ... ] });
cluster.on('error', (err) => console.log('Redis Cluster Error', err));
await cluster.connect();
await cluster.json.set('doc1', '$', { name: 'Alice', age: 32, coins: 100, email: 'alice@nonexist.com' })
await cluster.json.set('doc2', '$', { name: 'Bob', age: 23, coins: 15, email: 'bob@somewhere.gov' })
// Both mget commands should return all documents from cluster console.log(await cluster.json.mGet(['doc1', 'doc2'], '$..name')) console.log(await cluster.json.mGet(['doc2', 'doc1'], '$..name'))