Add "Date Fields" parameter to the insert & update operations

MongoDB
This commit is contained in:
ricardo
2021-03-10 11:01:03 -05:00
parent 9b23611a8d
commit ef9178d954
5 changed files with 84 additions and 13 deletions

View File

@@ -1,4 +1,6 @@
import { INodeTypeDescription } from 'n8n-workflow';
import {
INodeTypeDescription,
} from 'n8n-workflow';
/**
* Options to be displayed
@@ -6,7 +8,7 @@ import { INodeTypeDescription } from 'n8n-workflow';
export const nodeDescription: INodeTypeDescription = {
displayName: 'MongoDB',
name: 'mongoDb',
icon: 'file:mongoDb.png',
icon: 'file:mongoDb.svg',
group: ['input'],
version: 1,
description: 'Find, insert and update documents in MongoDB.',
@@ -46,7 +48,7 @@ export const nodeDescription: INodeTypeDescription = {
{
name: 'Update',
value: 'update',
description: 'Updates documents.',
description: 'Update documents.',
},
],
default: 'find',
@@ -97,7 +99,9 @@ export const nodeDescription: INodeTypeDescription = {
},
displayOptions: {
show: {
operation: ['find'],
operation: [
'find',
],
},
},
default: '{}',
@@ -115,7 +119,9 @@ export const nodeDescription: INodeTypeDescription = {
type: 'string',
displayOptions: {
show: {
operation: ['insert'],
operation: [
'insert',
],
},
},
default: '',
@@ -133,7 +139,9 @@ export const nodeDescription: INodeTypeDescription = {
type: 'string',
displayOptions: {
show: {
operation: ['update'],
operation: [
'update',
],
},
},
default: 'id',
@@ -147,7 +155,9 @@ export const nodeDescription: INodeTypeDescription = {
type: 'string',
displayOptions: {
show: {
operation: ['update'],
operation: [
'update',
],
},
},
default: '',
@@ -155,5 +165,29 @@ export const nodeDescription: INodeTypeDescription = {
description:
'Comma separated list of the fields to be included into the new document.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
displayOptions: {
show: {
operation: [
'update',
'insert',
],
},
},
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'Date Fields',
name: 'dateFields',
type: 'string',
default: '',
description: 'Comma separeted list of fields that will be parse as Mongo Date type.',
},
],
},
],
};