diff --git a/packages/nodes-base/nodes/Redis/Redis.node.ts b/packages/nodes-base/nodes/Redis/Redis.node.ts index 52f5fc5ac0..68b7401205 100644 --- a/packages/nodes-base/nodes/Redis/Redis.node.ts +++ b/packages/nodes-base/nodes/Redis/Redis.node.ts @@ -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.
+ This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.
+ If that is not intended this can be deactivated, it will then set { "a.b": value } instead. + `, + }, + ], + }, + // ---------------------------------- // keys // ---------------------------------- @@ -292,7 +319,7 @@ export class Redis implements INodeType { execute(this: IExecuteFunctions): Promise { // Parses the given value in a number if it is one else returns a string - function getParsedValue (value: string): string | number { + function getParsedValue(value: string): string | number { if (value.match(/^[\d\.]+$/) === null) { // Is a string return value; @@ -306,7 +333,7 @@ export class Redis implements INodeType { function convertInfoToObject(stringData: string): IDataObject { const returnData: IDataObject = {}; - let key:string, value:string; + let key: string, value: string; for (const line of stringData.split('\n')) { if (['#', ''].includes(line.charAt(0))) { continue; @@ -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; - set(item.json, propertyName, value); + + 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') {