Add limit, skip, sort, upsert in MongoDB node (#1439)

* mongodb find command improvements: limit, skip, sort

* mongodb update command improvement: upsert

*  improve mongo node

* 🎨 add missing semicolons

Co-authored-by: ahsan-virani <ahsan.virani@gmail.com>
This commit is contained in:
Anton Romanov
2021-04-14 14:41:56 +03:00
committed by GitHub
parent f4916c7efb
commit 315d3b59f5
2 changed files with 74 additions and 5 deletions

View File

@@ -90,6 +90,47 @@ export const nodeDescription: INodeTypeDescription = {
// ----------------------------------
// find
// ----------------------------------
{
displayName: 'Options',
name: 'options',
type: 'collection',
displayOptions: {
show: {
operation: ['find'],
},
},
default: {},
placeholder: 'Add options',
description: 'Add query options',
options: [
{
displayName: 'Limit',
name: 'limit',
type: "number",
default: 0,
description: 'Use limit to specify the maximum number of documents or 0 for unlimited documents.',
},
{
displayName: 'Skip',
name: 'skip',
type: "number",
default: 0,
description: 'The number of documents to skip in the results set.',
},
{
displayName: 'Sort (JSON format)',
name: 'sort',
type: 'json',
typeOptions: {
rows: 2,
},
default: '{}',
placeholder: '{ "field": -1 }',
required: true,
description: 'A json that defines the sort order of the result set.',
},
],
},
{
displayName: 'Query (JSON format)',
name: 'query',
@@ -109,7 +150,6 @@ export const nodeDescription: INodeTypeDescription = {
required: true,
description: 'MongoDB Find query.',
},
// ----------------------------------
// insert
// ----------------------------------
@@ -165,6 +205,18 @@ export const nodeDescription: INodeTypeDescription = {
description:
'Comma separated list of the fields to be included into the new document.',
},
{
displayName: 'Upsert',
name: 'upsert',
type: 'boolean',
displayOptions: {
show: {
operation: ['update'],
},
},
default: false,
description: `Perform an insert if no documents match the update key`,
},
{
displayName: 'Options',
name: 'options',