@lowdefy/connection-mongodb 0.0.0-experimental-20250915134255 → 0.0.0-experimental-20251010122007
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connections/MongoDBCollection/MongoDBAggregation/documentation.md +101 -0
- package/dist/connections/MongoDBCollection/MongoDBBulkWrite/documentation.md +359 -0
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/documentation.md +89 -0
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/documentation.md +92 -0
- package/dist/connections/MongoDBCollection/MongoDBFind/documentation.md +114 -0
- package/dist/connections/MongoDBCollection/MongoDBFindOne/documentation.md +109 -0
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/documentation.md +98 -0
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/documentation.md +94 -0
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/documentation.md +113 -0
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/documentation.md +133 -0
- package/dist/connections/MongoDBCollection/documentation.md +137 -0
- package/package.json +3 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBFind
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBFind` request executes a MongoDB [query](https://docs.mongodb.com/manual/tutorial/query-documents/) on the collection specified in the connectionId. It returns the array of documents returned by the query.
|
|
8
|
+
|
|
9
|
+
>Cursors are not supported. The request will return the whole body of the response as an array.
|
|
10
|
+
|
|
11
|
+
### Properties
|
|
12
|
+
|
|
13
|
+
- `query: object`: __Required__ - A MongoDB query object.
|
|
14
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#find) for more information. Supported settings are:
|
|
15
|
+
- `allowDiskUse: boolean`: Allows disk use for blocking sort operations exceeding 100MB memory. (MongoDB 3.2 or higher)
|
|
16
|
+
- `allowPartialResults: boolean`: For queries against a sharded collection, allows the command (or subsequent getMore commands) to return partial results, rather than an error, if one or more queried shards are available.
|
|
17
|
+
- `authdb: string`: Specifies the authentication information to be used.
|
|
18
|
+
- `awaitData: boolean`: Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true.
|
|
19
|
+
- `batchSize: number`: Set the batchSize for the getMoreCommand when iterating over the query results.
|
|
20
|
+
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
21
|
+
- `checkKeys: boolean`: The serializer will check if keys are valid.
|
|
22
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
23
|
+
- `comment: string | object`: Add a [comment](https://docs.mongodb.com/manual/reference/operator/query/comment/index.html) to the query. These comments are visible in the MongoDB profile log, making them easier to interpret.
|
|
24
|
+
- `dbName: string`: The database name.
|
|
25
|
+
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
26
|
+
- `fullResponse: boolean`: Return the full server response for the command.
|
|
27
|
+
- `hint: string | object`: Tell the query to use specific indexes in the query. Object of indexes to use, `{'_id':1}`.
|
|
28
|
+
- `ignoreUndefined: boolean`: Default: `true` - Serialize will not emit undefined fields.
|
|
29
|
+
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
30
|
+
- `limit: number`: Sets the limit of documents returned in the query.
|
|
31
|
+
- `max: object`: The exclusive upper bound for a specific index.
|
|
32
|
+
- `maxAwaitTimeMS: number`: The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. Requires `tailable` and `awaitData` to be true.
|
|
33
|
+
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
34
|
+
- `min: object`: The inclusive lower bound for a specific index.
|
|
35
|
+
- `noCursorTimeout: boolean`: The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
|
|
36
|
+
- `noResponse: boolean`: Admin command option.
|
|
37
|
+
- `projection: object`: The fields to return in the query. Object of fields to either include or exclude (one of, not both), `{'a':1, 'b': 1}` or `{'a': 0, 'b': 0}`.
|
|
38
|
+
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
39
|
+
- `readPreference: string | object`: The preferred read preference.
|
|
40
|
+
- `retryWrites: boolean`: Should retry failed writes.
|
|
41
|
+
- `returnKey: boolean`: If true, returns only the index keys in the resulting documents.
|
|
42
|
+
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
43
|
+
- `showRecordId: boolean`: Determine whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
|
|
44
|
+
- `singleBatch: boolean`: Default: `false` - Determines whether to close the cursor after the first batch.
|
|
45
|
+
- `skip: number`: Set to skip N documents ahead in your query (useful for pagination).
|
|
46
|
+
- `sort: array | object`: Set to sort the documents coming back from the query.
|
|
47
|
+
- `tailable: boolean`: Specify if the cursor is tailable.
|
|
48
|
+
- `timeout: boolean`: Specify if the cursor can timeout.
|
|
49
|
+
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
50
|
+
- `writeConcern: object`: An object that expresses the write concern.
|
|
51
|
+
|
|
52
|
+
</DESCRIPTION>
|
|
53
|
+
|
|
54
|
+
<CONNECTION>
|
|
55
|
+
MongoDBCollection
|
|
56
|
+
</CONNECTION>
|
|
57
|
+
|
|
58
|
+
<SCHEMA>
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
export default {
|
|
62
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
63
|
+
title: 'Lowdefy Request Schema - MongoDBFind',
|
|
64
|
+
type: 'object',
|
|
65
|
+
required: ['query'],
|
|
66
|
+
properties: {
|
|
67
|
+
query: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
description: 'A MongoDB query object',
|
|
70
|
+
errorMessage: {
|
|
71
|
+
type: 'MongoDBFind request property "query" should be an object.',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
options: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
description: 'Optional settings.',
|
|
77
|
+
errorMessage: {
|
|
78
|
+
type: 'MongoDBFind request property "options" should be an object.',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
errorMessage: {
|
|
83
|
+
type: 'MongoDBFind request properties should be an object.',
|
|
84
|
+
required: 'MongoDBFind request should have required property "query".',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
</SCHEMA>
|
|
90
|
+
|
|
91
|
+
<EXAMPLES>
|
|
92
|
+
|
|
93
|
+
### Find top ten scores above 90
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
requests:
|
|
97
|
+
- id: scores_top_ten_scores_above_90
|
|
98
|
+
type: MongoDBFind
|
|
99
|
+
connectionId: my_mongodb_collection_id
|
|
100
|
+
properties:
|
|
101
|
+
query:
|
|
102
|
+
score:
|
|
103
|
+
$gt: 90
|
|
104
|
+
options:
|
|
105
|
+
sort:
|
|
106
|
+
- - score
|
|
107
|
+
- -1
|
|
108
|
+
limit: 10
|
|
109
|
+
projection:
|
|
110
|
+
score: 1
|
|
111
|
+
name: 1
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBFindOne
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBFindOne` request executes a MongoDB [query](https://docs.mongodb.com/manual/tutorial/query-documents/) on the collection specified in the connectionId. It returns the first document that matches the specified query.
|
|
8
|
+
|
|
9
|
+
>Cursors are not supported. The request will return the whole body of the response as an array.
|
|
10
|
+
|
|
11
|
+
### Properties
|
|
12
|
+
|
|
13
|
+
- `query: object`: __Required__ - A MongoDB query object.
|
|
14
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#findone) for more information. Supported settings are:
|
|
15
|
+
- `allowDiskUse: boolean`: Allows disk use for blocking sort operations exceeding 100MB memory. (MongoDB 3.2 or higher)
|
|
16
|
+
- `allowPartialResults: boolean`: For queries against a sharded collection, allows the command (or subsequent getMore commands) to return partial results, rather than an error, if one or more queried shards are available.
|
|
17
|
+
- `authdb: string`: Specifies the authentication information to be used.
|
|
18
|
+
- `awaitData: boolean`: Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true.
|
|
19
|
+
- `batchSize: number`: Set the batchSize for the getMoreCommand when iterating over the query results.
|
|
20
|
+
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
21
|
+
- `checkKeys: boolean`: The serializer will check if keys are valid.
|
|
22
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
23
|
+
- `comment: string | object`: Add a [comment](https://docs.mongodb.com/manual/reference/operator/query/comment/index.html) to the query. These comments are visible in the MongoDB profile log, making them easier to interpret.
|
|
24
|
+
- `dbName: string`: The database name.
|
|
25
|
+
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
26
|
+
- `fullResponse: boolean`: Return the full server response for the command.
|
|
27
|
+
- `hint: string | object`: Tell the query to use specific indexes in the query. Object of indexes to use, `{'_id':1}`.
|
|
28
|
+
- `ignoreUndefined: boolean`: Default: `true` - Serialize will not emit undefined fields.
|
|
29
|
+
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
30
|
+
- `limit: number`: Sets the limit of documents returned in the query.
|
|
31
|
+
- `max: object`: The exclusive upper bound for a specific index.
|
|
32
|
+
- `maxAwaitTimeMS: number`: The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. Requires `tailable` and `awaitData` to be true.
|
|
33
|
+
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
34
|
+
- `min: object`: The inclusive lower bound for a specific index.
|
|
35
|
+
- `noCursorTimeout: boolean`: The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
|
|
36
|
+
- `noResponse: boolean`: Admin command option.
|
|
37
|
+
- `projection: object`: The fields to return in the query. Object of fields to either include or exclude (one of, not both), `{'a':1, 'b': 1}` or `{'a': 0, 'b': 0}`.
|
|
38
|
+
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
39
|
+
- `readPreference: string | object`: The preferred read preference.
|
|
40
|
+
- `retryWrites: boolean`: Should retry failed writes.
|
|
41
|
+
- `returnKey: boolean`: If true, returns only the index keys in the resulting documents.
|
|
42
|
+
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
43
|
+
- `showRecordId: boolean`: Determine whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
|
|
44
|
+
- `singleBatch: boolean`: Default: `false` - Determines whether to close the cursor after the first batch.
|
|
45
|
+
- `skip: number`: Set to skip N documents ahead in your query (useful for pagination).
|
|
46
|
+
- `sort: array | object`: Set to sort the documents coming back from the query.
|
|
47
|
+
- `tailable: boolean`: Specify if the cursor is tailable.
|
|
48
|
+
- `timeout: boolean`: Specify if the cursor can timeout.
|
|
49
|
+
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
50
|
+
- `writeConcern: object`: An object that expresses the write concern.
|
|
51
|
+
|
|
52
|
+
</DESCRIPTION>
|
|
53
|
+
|
|
54
|
+
<CONNECTION>
|
|
55
|
+
MongoDBCollection
|
|
56
|
+
</CONNECTION>
|
|
57
|
+
|
|
58
|
+
<SCHEMA>
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
export default {
|
|
62
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
63
|
+
title: 'Lowdefy Request Schema - MongoDBFindOne',
|
|
64
|
+
type: 'object',
|
|
65
|
+
required: ['query'],
|
|
66
|
+
properties: {
|
|
67
|
+
query: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
description: 'A MongoDB query object',
|
|
70
|
+
errorMessage: {
|
|
71
|
+
type: 'MongoDBFindOne request property "query" should be an object.',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
options: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
description: 'Optional settings.',
|
|
77
|
+
errorMessage: {
|
|
78
|
+
type: 'MongoDBFindOne request property "options" should be an object.',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
errorMessage: {
|
|
83
|
+
type: 'MongoDBFindOne request properties should be an object.',
|
|
84
|
+
required: 'MongoDBFindOne request should have required property "query".',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
</SCHEMA>
|
|
90
|
+
|
|
91
|
+
<EXAMPLES>
|
|
92
|
+
|
|
93
|
+
### Find a document by id
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
requests:
|
|
97
|
+
- id: find_by_id
|
|
98
|
+
type: MongoDBFindOne
|
|
99
|
+
connectionId: my_mongodb_collection_id
|
|
100
|
+
payload:
|
|
101
|
+
_id:
|
|
102
|
+
_input: _id
|
|
103
|
+
properties:
|
|
104
|
+
query:
|
|
105
|
+
_id:
|
|
106
|
+
_payload: _id
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBInsertMany
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBInsertMany` request inserts an array of documents into the collection specified in the connectionId. If a `_id` field is not specified on a document, a MongoDB `ObjectID` will be generated.
|
|
8
|
+
|
|
9
|
+
### Properties
|
|
10
|
+
|
|
11
|
+
- `docs: object[]`: __Required__ - The array of documents to be inserted.
|
|
12
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertmany) for more information. Supported settings are:
|
|
13
|
+
- `authdb: string`: Specifies the authentication information to be used.
|
|
14
|
+
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
15
|
+
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher
|
|
16
|
+
- `checkKeys: boolean`: Default: `true` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
17
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
18
|
+
- `comment: string | object`: Add a [comment](https://docs.mongodb.com/manual/reference/operator/query/comment/index.html) to the query. These comments are visible in the MongoDB profile log, making them easier to interpret.
|
|
19
|
+
- `dbName: string`: The database name.
|
|
20
|
+
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
21
|
+
- `forcesServerObjectId: boolean`: Default: `false` - Force server to assign _id values instead of driver.
|
|
22
|
+
- `fullResponse: boolean`: Return the full server response for the command.
|
|
23
|
+
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
24
|
+
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
25
|
+
- `noResponse: boolean`: Admin command option.
|
|
26
|
+
- `ordered: boolean`: If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
|
|
27
|
+
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
28
|
+
- `readPreference: object`: The preferred read preference.
|
|
29
|
+
- `retryWrites: boolean`: Should retry failed writes.
|
|
30
|
+
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
31
|
+
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
32
|
+
- `writeConcern: object`: An object that expresses the write concern.
|
|
33
|
+
|
|
34
|
+
</DESCRIPTION>
|
|
35
|
+
|
|
36
|
+
<CONNECTION>
|
|
37
|
+
MongoDBCollection
|
|
38
|
+
</CONNECTION>
|
|
39
|
+
|
|
40
|
+
<SCHEMA>
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
export default {
|
|
44
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
45
|
+
title: 'Lowdefy Request Schema - MongoDBInsertMany',
|
|
46
|
+
type: 'object',
|
|
47
|
+
required: ['docs'],
|
|
48
|
+
properties: {
|
|
49
|
+
docs: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
description: 'The array of documents to be inserted.',
|
|
52
|
+
errorMessage: {
|
|
53
|
+
type: 'MongoDBInsertMany request property "docs" should be an array.',
|
|
54
|
+
},
|
|
55
|
+
items: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
errorMessage: {
|
|
58
|
+
type: 'MongoDBInsertMany request property "docs" should be an array of documents to insert.',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
options: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
description: 'Optional settings.',
|
|
65
|
+
errorMessage: {
|
|
66
|
+
type: 'MongoDBInsertMany request property "options" should be an object.',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
errorMessage: {
|
|
71
|
+
type: 'MongoDBInsertMany request properties should be an object.',
|
|
72
|
+
required: 'MongoDBInsertMany request should have required property "docs".',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
</SCHEMA>
|
|
78
|
+
|
|
79
|
+
<EXAMPLES>
|
|
80
|
+
|
|
81
|
+
### Insert a set of documents
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
requests:
|
|
85
|
+
- id: insert_documents
|
|
86
|
+
type: MongoDBInsertMany
|
|
87
|
+
connectionId: my_mongodb_collection_id
|
|
88
|
+
properties:
|
|
89
|
+
docs:
|
|
90
|
+
- _id: 1
|
|
91
|
+
value: 4
|
|
92
|
+
- _id: 2
|
|
93
|
+
value: 1
|
|
94
|
+
- _id: 3
|
|
95
|
+
value: 7
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBInsertOne
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBInsertOne` request inserts a document into the collection specified in the connectionId. If a `_id` field is not specified, a MongoDB `ObjectID` will be generated.
|
|
8
|
+
|
|
9
|
+
### Properties
|
|
10
|
+
|
|
11
|
+
- `doc: object`: __Required__ - The document to be inserted.
|
|
12
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertone) for more information. Supported settings are:
|
|
13
|
+
- `authdb: string`: Specifies the authentication information to be used.
|
|
14
|
+
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
15
|
+
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher
|
|
16
|
+
- `checkKeys: boolean`: Default: `true` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
17
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
18
|
+
- `comment: string | object`: Add a [comment](https://docs.mongodb.com/manual/reference/operator/query/comment/index.html) to the query. These comments are visible in the MongoDB profile log, making them easier to interpret.
|
|
19
|
+
- `dbName: string`: The database name.
|
|
20
|
+
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
21
|
+
- `forcesServerObjectId: boolean`: Default: `false` - Force server to assign _id values instead of driver.
|
|
22
|
+
- `fullResponse: boolean`: Return the full server response for the command.
|
|
23
|
+
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
24
|
+
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
25
|
+
- `noResponse: boolean`: Admin command option.
|
|
26
|
+
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
27
|
+
- `readPreference: object`: The preferred read preference.
|
|
28
|
+
- `retryWrites: boolean`: Should retry failed writes.
|
|
29
|
+
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
30
|
+
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
31
|
+
- `writeConcern: object`: An object that expresses the write concern.
|
|
32
|
+
|
|
33
|
+
</DESCRIPTION>
|
|
34
|
+
|
|
35
|
+
<CONNECTION>
|
|
36
|
+
MongoDBCollection
|
|
37
|
+
</CONNECTION>
|
|
38
|
+
|
|
39
|
+
<SCHEMA>
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
export default {
|
|
43
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
44
|
+
title: 'Lowdefy Request Schema - MongoDBInsertOne',
|
|
45
|
+
type: 'object',
|
|
46
|
+
required: ['doc'],
|
|
47
|
+
properties: {
|
|
48
|
+
doc: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
description: 'The document to be inserted.',
|
|
51
|
+
errorMessage: {
|
|
52
|
+
type: 'MongoDBInsertOne request property "doc" should be an object.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
options: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
description: 'Optional settings.',
|
|
58
|
+
errorMessage: {
|
|
59
|
+
type: 'MongoDBInsertOne request property "options" should be an object.',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
errorMessage: {
|
|
64
|
+
type: 'MongoDBInsertOne request properties should be an object.',
|
|
65
|
+
required: 'MongoDBInsertOne request should have required property "doc".',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
</SCHEMA>
|
|
71
|
+
|
|
72
|
+
<EXAMPLES>
|
|
73
|
+
|
|
74
|
+
### Insert a document
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
requests:
|
|
78
|
+
- id: insert_new_comment
|
|
79
|
+
type: MongoDBInsertOne
|
|
80
|
+
connectionId: my_mongodb_collection_id
|
|
81
|
+
payload:
|
|
82
|
+
comment:
|
|
83
|
+
_state: comment_input
|
|
84
|
+
properties:
|
|
85
|
+
doc:
|
|
86
|
+
comment:
|
|
87
|
+
_payload: comment
|
|
88
|
+
user_id:
|
|
89
|
+
_user: id
|
|
90
|
+
timestamp:
|
|
91
|
+
_date: now
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBUpdateMany
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBUpdateMany` request updates multiple documents that match a certain criteria in the collection specified in the connectionId. It requires a filter, which is written in the query syntax, to select the documents to update.
|
|
8
|
+
|
|
9
|
+
### Properties
|
|
10
|
+
|
|
11
|
+
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
12
|
+
- `update: object | object[]`: __Required__ - The update operations to be applied to the document.
|
|
13
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#updateOne) for more information. Supported settings are:
|
|
14
|
+
- `arrayFilters: string[]`: Array filters for the [`$[<identifier>]`](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) array update operator.
|
|
15
|
+
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
16
|
+
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
17
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
18
|
+
- `forceServerObjectId: boolean`: Force server to assign _id values instead of driver.
|
|
19
|
+
- `hint: object`: An optional hint for query optimization.
|
|
20
|
+
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
21
|
+
- `j: boolean`: Specify a journal write concern.
|
|
22
|
+
- `upsert: boolean`: Default: `false` - Insert document if no match is found.
|
|
23
|
+
- `w: number | string`: The write concern.
|
|
24
|
+
- `wtimeout: number`: The write concern timeout.
|
|
25
|
+
|
|
26
|
+
</DESCRIPTION>
|
|
27
|
+
|
|
28
|
+
<CONNECTION>
|
|
29
|
+
MongoDBCollection
|
|
30
|
+
</CONNECTION>
|
|
31
|
+
|
|
32
|
+
<SCHEMA>
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
export default {
|
|
36
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
37
|
+
title: 'Lowdefy Request Schema - MongoDBUpdateMany',
|
|
38
|
+
type: 'object',
|
|
39
|
+
required: ['filter', 'update'],
|
|
40
|
+
properties: {
|
|
41
|
+
filter: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
description: 'The filter used to select the documents to update.',
|
|
44
|
+
errorMessage: {
|
|
45
|
+
type: 'MongoDBUpdateMany request property "filter" should be an object.',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
update: {
|
|
49
|
+
type: ['object', 'array'],
|
|
50
|
+
description: 'The update operations to be applied to the documents.',
|
|
51
|
+
errorMessage: {
|
|
52
|
+
type: 'MongoDBUpdateMany request property "update" should be an object.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
options: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
description: 'Optional settings.',
|
|
58
|
+
errorMessage: {
|
|
59
|
+
type: 'MongoDBUpdateMany request property "options" should be an object.',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
errorMessage: {
|
|
64
|
+
type: 'MongoDBUpdateMany request properties should be an object.',
|
|
65
|
+
required: {
|
|
66
|
+
filter: 'MongoDBUpdateMany request should have required property "filter".',
|
|
67
|
+
update: 'MongoDBUpdateMany request should have required property "update".',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
</SCHEMA>
|
|
74
|
+
|
|
75
|
+
<EXAMPLES>
|
|
76
|
+
|
|
77
|
+
### Set a list of documents as resolved
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
requests:
|
|
81
|
+
- id: set_resolved
|
|
82
|
+
type: MongoDBUpdateMany
|
|
83
|
+
connectionId: my_mongodb_collection_id
|
|
84
|
+
payload:
|
|
85
|
+
selected_issues_list:
|
|
86
|
+
_state: selected_issues_list
|
|
87
|
+
properties:
|
|
88
|
+
# Select all documents where the _id is in selected_issues_list in state
|
|
89
|
+
filter:
|
|
90
|
+
_id:
|
|
91
|
+
$in:
|
|
92
|
+
_payload: selected_issues_list
|
|
93
|
+
update:
|
|
94
|
+
$set:
|
|
95
|
+
resolved: true
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Mark all documents with score less than 6 as urgent
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
requests:
|
|
102
|
+
- id: set_resolved
|
|
103
|
+
type: MongoDBUpdateMany
|
|
104
|
+
properties:
|
|
105
|
+
filter:
|
|
106
|
+
score:
|
|
107
|
+
$lt: 6
|
|
108
|
+
update:
|
|
109
|
+
$set:
|
|
110
|
+
status: urgent
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
MongoDBUpdateOne
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `MongoDBUpdateOne` request updates a single document in the collection specified in the connectionId. It requires a filter, which is written in the query syntax, to select a document to update. It will update the first document that matches the filter. If the `upsert` option is set to true, it will insert a new document if no document is found to update.
|
|
8
|
+
> MongoDBUpdateOne response differs when the connection has a log collection. When a log collection is set on the connection, a findOneAndUpdate operation is performed compared to the standard updateOne operation.
|
|
9
|
+
|
|
10
|
+
### Properties
|
|
11
|
+
|
|
12
|
+
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
13
|
+
- `update: object | object[]`: __Required__ - The update operations to be applied to the document.
|
|
14
|
+
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#updateone) for more information. Supported settings are:
|
|
15
|
+
- `arrayFilters: object[]`: _Array_ - Array filters for the [`$[<identifier>]`](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) array update operator.
|
|
16
|
+
- `authdb: string`: Specifies the authentication information to be used.
|
|
17
|
+
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
18
|
+
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
19
|
+
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
20
|
+
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
21
|
+
- `comment: string | object`: A user-provided comment to attach to this command.
|
|
22
|
+
- `dbName: string`: The database name.
|
|
23
|
+
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
24
|
+
- `fullResponse: boolean`: Return the full server response for the command.
|
|
25
|
+
- `hint: string | object`: An optional hint for query optimization.
|
|
26
|
+
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
27
|
+
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
28
|
+
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
29
|
+
- `noResponse: boolean`: Admin command option.
|
|
30
|
+
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
31
|
+
- `readPreference: object`: The preferred read preference.
|
|
32
|
+
- `retryWrites: boolean`: Should retry failed writes.
|
|
33
|
+
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
34
|
+
- `upsert: boolean`: Default: `false` - Insert document if no match is found.
|
|
35
|
+
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
36
|
+
- `writeConcern: object`: An object that expresses the write concern.
|
|
37
|
+
|
|
38
|
+
</DESCRIPTION>
|
|
39
|
+
|
|
40
|
+
<CONNECTION>
|
|
41
|
+
MongoDBCollection
|
|
42
|
+
</CONNECTION>
|
|
43
|
+
|
|
44
|
+
<SCHEMA>
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
export default {
|
|
48
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
49
|
+
title: 'Lowdefy Request Schema - MongoDBUpdateOne',
|
|
50
|
+
type: 'object',
|
|
51
|
+
required: ['filter', 'update'],
|
|
52
|
+
properties: {
|
|
53
|
+
filter: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
description: 'The filter used to select the document to update.',
|
|
56
|
+
errorMessage: {
|
|
57
|
+
type: 'MongoDBUpdateOne request property "filter" should be an object.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
update: {
|
|
61
|
+
type: ['object', 'array'],
|
|
62
|
+
description: 'The update operations to be applied to the document.',
|
|
63
|
+
errorMessage: {
|
|
64
|
+
type: 'MongoDBUpdateOne request property "update" should be an object.',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
options: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
description: 'Optional settings.',
|
|
70
|
+
errorMessage: {
|
|
71
|
+
type: 'MongoDBUpdateOne request property "options" should be an object.',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
errorMessage: {
|
|
76
|
+
type: 'MongoDBUpdateOne request properties should be an object.',
|
|
77
|
+
required: {
|
|
78
|
+
filter: 'MongoDBUpdateOne request should have required property "filter".',
|
|
79
|
+
update: 'MongoDBUpdateOne request should have required property "update".',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
</SCHEMA>
|
|
86
|
+
|
|
87
|
+
<EXAMPLES>
|
|
88
|
+
|
|
89
|
+
### Update a document
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
requests:
|
|
93
|
+
- id: update
|
|
94
|
+
type: MongoDBUpdateOne
|
|
95
|
+
connectionId: my_mongodb_collection_id
|
|
96
|
+
payload:
|
|
97
|
+
_id:
|
|
98
|
+
_state: _id
|
|
99
|
+
properties:
|
|
100
|
+
filter:
|
|
101
|
+
_id:
|
|
102
|
+
_payload: _id
|
|
103
|
+
update:
|
|
104
|
+
$set:
|
|
105
|
+
_state: true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Like a comment
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
requests:
|
|
112
|
+
- id: like_comment
|
|
113
|
+
type: MongoDBUpdateOne
|
|
114
|
+
connectionId: my_mongodb_collection_id
|
|
115
|
+
payload:
|
|
116
|
+
comment_id:
|
|
117
|
+
_state: comment._id
|
|
118
|
+
properties:
|
|
119
|
+
filter:
|
|
120
|
+
_id:
|
|
121
|
+
_payload: comment_id
|
|
122
|
+
update:
|
|
123
|
+
$inc:
|
|
124
|
+
likes: 1
|
|
125
|
+
$push:
|
|
126
|
+
liked_by:
|
|
127
|
+
_user.id:
|
|
128
|
+
$set:
|
|
129
|
+
last_liked:
|
|
130
|
+
_date: now
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
</EXAMPLES>
|