2023-01-27 03:22:44 -08:00
|
|
|
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
2019-10-15 09:39:00 -07:00
|
|
|
|
2019-10-27 14:45:48 -07:00
|
|
|
export class MongoDb implements ICredentialType {
|
|
|
|
name = 'mongoDb';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2019-10-15 09:39:00 -07:00
|
|
|
displayName = 'MongoDB';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'mongoDb';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2020-05-01 11:24:20 -07:00
|
|
|
{
|
|
|
|
displayName: 'Configuration Type',
|
|
|
|
name: 'configurationType',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'options',
|
2020-05-01 11:24:20 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Connection String',
|
|
|
|
value: 'connectionString',
|
|
|
|
description: 'Provide connection data via string',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Values',
|
|
|
|
value: 'values',
|
|
|
|
description: 'Provide connection data via values',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'values',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Connection String',
|
|
|
|
name: 'connectionString',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-05-01 11:24:20 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
configurationType: ['connectionString'],
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-07-24 08:36:17 -07:00
|
|
|
placeholder:
|
|
|
|
'mongodb://<USERNAME>:<PASSWORD>@localhost:27017/?authSource=admin&readPreference=primary&appname=n8n&ssl=false',
|
|
|
|
description:
|
|
|
|
'If provided, the value here will be used as a MongoDB connection string, and the MongoDB credentials will be ignored',
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
2019-10-15 09:39:00 -07:00
|
|
|
{
|
|
|
|
displayName: 'Host',
|
|
|
|
name: 'host',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-05-01 11:24:20 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
configurationType: ['values'],
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
default: 'localhost',
|
2019-10-15 09:39:00 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Database',
|
|
|
|
name: 'database',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-10-15 09:39:00 -07:00
|
|
|
default: '',
|
2022-07-24 08:36:17 -07:00
|
|
|
description:
|
|
|
|
'Note: the database should still be provided even if using an override connection string',
|
2019-10-15 09:39:00 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'User',
|
|
|
|
name: 'user',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-05-01 11:24:20 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
configurationType: ['values'],
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
default: '',
|
2019-10-15 09:39:00 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Password',
|
|
|
|
name: 'password',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-10-15 09:39:00 -07:00
|
|
|
typeOptions: {
|
2020-10-22 06:46:03 -07:00
|
|
|
password: true,
|
2019-10-15 09:39:00 -07:00
|
|
|
},
|
2020-05-01 11:24:20 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
configurationType: ['values'],
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
default: '',
|
2019-10-15 09:39:00 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Port',
|
|
|
|
name: 'port',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'number',
|
2020-05-01 11:24:20 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
configurationType: ['values'],
|
2020-05-01 11:24:20 -07:00
|
|
|
},
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
default: 27017,
|
2020-04-06 18:07:54 -07:00
|
|
|
},
|
2024-01-10 05:02:05 -08:00
|
|
|
{
|
|
|
|
displayName: 'Use TLS',
|
|
|
|
name: 'tls',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'CA Certificate',
|
|
|
|
name: 'ca',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
tls: [true],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Public Client Certificate',
|
|
|
|
name: 'cert',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
tls: [true],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Private Client Key',
|
|
|
|
name: 'key',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
tls: [true],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Passphrase',
|
|
|
|
name: 'passphrase',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
tls: [true],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
2019-10-15 09:39:00 -07:00
|
|
|
];
|
|
|
|
}
|