mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Fix issue with dot-notation on redis node
This commit is contained in:
parent
384db05483
commit
adff086ea2
|
@ -158,6 +158,33 @@ export class Redis implements INodeType {
|
|||
description: 'The type of the key to get.',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get'
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'Add Option',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Dot Notation',
|
||||
name: 'dotNotation',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: `By default does dot-notation get used in property names.<br />
|
||||
This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.<br />
|
||||
If that is not intended this can be deactivated, it will then set { "a.b": value } instead.
|
||||
`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// keys
|
||||
// ----------------------------------
|
||||
|
@ -450,7 +477,15 @@ export class Redis implements INodeType {
|
|||
const keyType = this.getNodeParameter('keyType', itemIndex) as string;
|
||||
|
||||
const value = await getValue(client, keyGet, keyType) || null;
|
||||
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
|
||||
|
||||
if (options.dotNotation === false) {
|
||||
item.json[propertyName] = value;
|
||||
} else {
|
||||
set(item.json, propertyName, value);
|
||||
}
|
||||
|
||||
returnItems.push(item);
|
||||
} else if (operation === 'keys') {
|
||||
const keyPattern = this.getNodeParameter('keyPattern', itemIndex) as string;
|
||||
|
@ -467,7 +502,7 @@ export class Redis implements INodeType {
|
|||
}
|
||||
|
||||
for (const keyName of keys) {
|
||||
set(item.json, keyName, await promises[keyName]);
|
||||
item.json[keyName] = await promises[keyName];
|
||||
}
|
||||
returnItems.push(item);
|
||||
} else if (operation === 'set') {
|
||||
|
|
Loading…
Reference in a new issue