@lowdefy/docs 4.0.0-alpha.7 → 4.0.0-alpha.8
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/operators/client/filter_default_value.js +55 -0
- package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
- package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
- package/package.json +19 -3
- package/404.yaml +0 -26
- package/CHANGELOG.md +0 -697
- package/actions/CallMethod.yaml +0 -57
- package/actions/JsAction.yaml +0 -281
- package/actions/Link.yaml +0 -120
- package/actions/Login.yaml +0 -123
- package/actions/Logout.yaml +0 -44
- package/actions/Message.yaml +0 -68
- package/actions/Notification.yaml +0 -84
- package/actions/Request.yaml +0 -70
- package/actions/Reset.yaml +0 -42
- package/actions/ResetValidation.yaml +0 -102
- package/actions/ScrollTo.yaml +0 -100
- package/actions/SetGlobal.yaml +0 -78
- package/actions/SetState.yaml +0 -85
- package/actions/Throw.yaml +0 -89
- package/actions/Validate.yaml +0 -104
- package/actions/Wait.yaml +0 -40
- package/blocks/all_icons.yaml +0 -803
- package/blocks/container/Affix.yaml +0 -26
- package/blocks/container/Alert.yaml +0 -27
- package/blocks/container/Badge.yaml +0 -27
- package/blocks/container/Box.yaml +0 -27
- package/blocks/container/Card.yaml +0 -29
- package/blocks/container/Collapse.yaml +0 -38
- package/blocks/container/Comment.yaml +0 -43
- package/blocks/container/ConfirmModal.yaml +0 -36
- package/blocks/container/Descriptions.yaml +0 -51
- package/blocks/container/Drawer.yaml +0 -46
- package/blocks/container/Label.yaml +0 -28
- package/blocks/container/Modal.yaml +0 -46
- package/blocks/container/PageHCF.yaml +0 -28
- package/blocks/container/PageHCSF.yaml +0 -29
- package/blocks/container/PageHSCF.yaml +0 -29
- package/blocks/container/PageHeaderMenu.yaml +0 -52
- package/blocks/container/PageSHCF.yaml +0 -29
- package/blocks/container/PageSiderMenu.yaml +0 -53
- package/blocks/container/Result.yaml +0 -34
- package/blocks/container/Span.yaml +0 -27
- package/blocks/container/Spin.yaml +0 -27
- package/blocks/container/Tabs.yaml +0 -41
- package/blocks/container/Tooltip.yaml +0 -38
- package/blocks/display/Anchor.yaml +0 -25
- package/blocks/display/Avatar.yaml +0 -23
- package/blocks/display/Breadcrumb.yaml +0 -28
- package/blocks/display/Button.yaml +0 -43
- package/blocks/display/DangerousHtml.yaml +0 -62
- package/blocks/display/DangerousMarkdown.yaml +0 -46
- package/blocks/display/Divider.yaml +0 -23
- package/blocks/display/EChart.yaml +0 -53
- package/blocks/display/Html.yaml +0 -50
- package/blocks/display/Icon.yaml +0 -23
- package/blocks/display/Img.yaml +0 -40
- package/blocks/display/Markdown.yaml +0 -31
- package/blocks/display/MarkdownWithCode.yaml +0 -46
- package/blocks/display/Menu.yaml +0 -48
- package/blocks/display/Message.yaml +0 -34
- package/blocks/display/MobileMenu.yaml +0 -47
- package/blocks/display/Notification.yaml +0 -34
- package/blocks/display/Paragraph.yaml +0 -30
- package/blocks/display/Progress.yaml +0 -52
- package/blocks/display/Skeleton.yaml +0 -27
- package/blocks/display/Statistic.yaml +0 -35
- package/blocks/display/Title.yaml +0 -32
- package/blocks/input/AutoComplete.yaml +0 -30
- package/blocks/input/ButtonSelector.yaml +0 -36
- package/blocks/input/CheckboxSelector.yaml +0 -36
- package/blocks/input/CheckboxSwitch.yaml +0 -56
- package/blocks/input/ChromeColorSelector.yaml +0 -24
- package/blocks/input/CircleColorSelector.yaml +0 -24
- package/blocks/input/ColorSelector.yaml +0 -24
- package/blocks/input/CompactColorSelector.yaml +0 -24
- package/blocks/input/DateRangeSelector.yaml +0 -26
- package/blocks/input/DateSelector.yaml +0 -26
- package/blocks/input/DateTimeSelector.yaml +0 -28
- package/blocks/input/GithubColorSelector.yaml +0 -24
- package/blocks/input/MonthSelector.yaml +0 -26
- package/blocks/input/MultipleSelector.yaml +0 -117
- package/blocks/input/NumberInput.yaml +0 -24
- package/blocks/input/Pagination.yaml +0 -33
- package/blocks/input/ParagraphInput.yaml +0 -32
- package/blocks/input/PasswordInput.yaml +0 -48
- package/blocks/input/RadioSelector.yaml +0 -36
- package/blocks/input/RatingSlider.yaml +0 -24
- package/blocks/input/S3UploadButton.yaml +0 -28
- package/blocks/input/Selector.yaml +0 -98
- package/blocks/input/SliderColorSelector.yaml +0 -24
- package/blocks/input/SwatchesColorSelector.yaml +0 -24
- package/blocks/input/Switch.yaml +0 -24
- package/blocks/input/TextArea.yaml +0 -27
- package/blocks/input/TextInput.yaml +0 -59
- package/blocks/input/TitleInput.yaml +0 -32
- package/blocks/input/TwitterColorSelector.yaml +0 -24
- package/blocks/input/WeekSelector.yaml +0 -26
- package/blocks/list/ControlledList.yaml +0 -191
- package/blocks/list/List.yaml +0 -157
- package/blocks/list/TimelineList.yaml +0 -136
- package/body.html +0 -1
- package/concepts/blocks.yaml +0 -249
- package/concepts/cli.yaml +0 -173
- package/concepts/connections-and-requests.yaml +0 -114
- package/concepts/context-and-state.yaml +0 -82
- package/concepts/custom-blocks.yaml +0 -190
- package/concepts/custom-code.yaml +0 -197
- package/concepts/events-and-actions.yaml +0 -224
- package/concepts/hosting-files.yaml +0 -50
- package/concepts/layout.yaml +0 -1464
- package/concepts/lists.yaml +0 -162
- package/concepts/lowdefy-schema.yaml +0 -245
- package/concepts/operators.yaml +0 -66
- package/concepts/overview.yaml +0 -48
- package/concepts/secrets.yaml +0 -56
- package/connections/AWSS3.yaml +0 -228
- package/connections/AmazonRedshift.yaml +0 -75
- package/connections/AxiosHttp.yaml +0 -194
- package/connections/Elasticsearch.yaml +0 -378
- package/connections/GoogleSheet.yaml +0 -332
- package/connections/Knex.yaml +0 -181
- package/connections/KnexRequests.md +0 -121
- package/connections/MSSQL.yaml +0 -90
- package/connections/MariaDB.yaml +0 -77
- package/connections/MongoDB.yaml +0 -581
- package/connections/MySQL.yaml +0 -92
- package/connections/OracleDB.yaml +0 -73
- package/connections/PostgreSQL.yaml +0 -99
- package/connections/Redis.yaml +0 -147
- package/connections/SQLite.yaml +0 -94
- package/connections/SendGridMail.yaml +0 -113
- package/connections/Stripe.yaml +0 -139
- package/deployment/aws-lambda.yaml +0 -128
- package/deployment/docker.yaml +0 -118
- package/deployment/netlify.yaml +0 -69
- package/deployment/node-server.yaml +0 -111
- package/head.html +0 -7
- package/howto/generate-csv.yaml.njk +0 -252
- package/howto/generate-pdf.yaml.njk +0 -651
- package/howto/generateCsv/lowdefy.yaml +0 -64
- package/howto/generateCsv/public/csvMake.js +0 -27
- package/howto/generatePdf/inv_template.yaml +0 -200
- package/howto/generatePdf/lowdefy.yaml +0 -117
- package/howto/generatePdf/my_header.html +0 -1
- package/howto/generatePdf/public/logo_example.png +0 -0
- package/howto/generatePdf/public/modules/importUmd.js +0 -7
- package/howto/generatePdf/public/modules/pdfMake.js +0 -7
- package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
- package/howto/use-refrences.md +0 -5
- package/introduction.yaml +0 -100
- package/lowdefy.yaml +0 -66
- package/menus.yaml +0 -832
- package/operators/_actions.yaml +0 -123
- package/operators/_and.yaml +0 -90
- package/operators/_args.yaml +0 -79
- package/operators/_array.yaml +0 -326
- package/operators/_base64.yaml +0 -56
- package/operators/_change_case.yaml +0 -347
- package/operators/_date.yaml +0 -71
- package/operators/_diff.yaml +0 -75
- package/operators/_divide.yaml +0 -46
- package/operators/_eq.yaml +0 -67
- package/operators/_event.yaml +0 -103
- package/operators/_format.yaml +0 -209
- package/operators/_function.yaml +0 -66
- package/operators/_get.yaml +0 -108
- package/operators/_global.yaml +0 -107
- package/operators/_gt.yaml +0 -65
- package/operators/_gte.yaml +0 -65
- package/operators/_hash.yaml +0 -109
- package/operators/_if.yaml +0 -44
- package/operators/_if_none.yaml +0 -61
- package/operators/_index.yaml +0 -65
- package/operators/_input.yaml +0 -114
- package/operators/_js.yaml +0 -189
- package/operators/_json.yaml +0 -128
- package/operators/_list_contexts.yaml +0 -37
- package/operators/_location.yaml +0 -59
- package/operators/_log.yaml +0 -36
- package/operators/_lt.yaml +0 -65
- package/operators/_lte.yaml +0 -65
- package/operators/_math.yaml +0 -374
- package/operators/_media.yaml +0 -86
- package/operators/_menu.yaml +0 -81
- package/operators/_mql.yaml +0 -101
- package/operators/_ne.yaml +0 -77
- package/operators/_not.yaml +0 -47
- package/operators/_number.yaml +0 -157
- package/operators/_nunjucks.yaml +0 -73
- package/operators/_object.yaml +0 -193
- package/operators/_operator.yaml +0 -47
- package/operators/_or.yaml +0 -81
- package/operators/_product.yaml +0 -59
- package/operators/_random.yaml +0 -104
- package/operators/_ref.yaml +0 -266
- package/operators/_regex.yaml +0 -83
- package/operators/_request.yaml +0 -50
- package/operators/_secret.yaml +0 -74
- package/operators/_state.yaml +0 -114
- package/operators/_string.yaml +0 -283
- package/operators/_subtract.yaml +0 -38
- package/operators/_sum.yaml +0 -59
- package/operators/_switch.yaml +0 -51
- package/operators/_type.yaml +0 -92
- package/operators/_uri.yaml +0 -56
- package/operators/_url_query.yaml +0 -120
- package/operators/_user.yaml +0 -107
- package/operators/_uuid.yaml +0 -114
- package/operators/_var.yaml +0 -105
- package/operators/_yaml.yaml +0 -107
- package/pages.yaml +0 -227
- package/public/images/authors/gervwyk.jpeg +0 -0
- package/public/images/authors/sandile.jpeg +0 -0
- package/public/images/howto/header_generate_csv.jpg +0 -0
- package/public/images/howto/header_generate_pdf.jpg +0 -0
- package/public/logo_example.png +0 -0
- package/public/lowdefy_app_schema.png +0 -0
- package/public/modules/csvMake.js +0 -27
- package/public/modules/filterDefaultValue.js +0 -48
- package/public/modules/importUmd.js +0 -7
- package/public/modules/index.js +0 -5
- package/public/modules/pdfMake.js +0 -7
- package/public/modules/test/filterDefaultValue.test.js +0 -91
- package/public/modules/vfs_fonts.js +0 -12
- package/public/sitemap.xml +0 -1024
- package/templates/actions.yaml.njk +0 -68
- package/templates/blocks/defaultValueTransformer.js +0 -53
- package/templates/blocks/exampleTransformer.js +0 -81
- package/templates/blocks/layout.yaml +0 -114
- package/templates/blocks/propertiesFormTransformer.js +0 -419
- package/templates/blocks/propertiesGetterTransformer.js +0 -132
- package/templates/blocks/schema.yaml.njk +0 -42
- package/templates/blocks/style.yaml +0 -26
- package/templates/blocks/template.yaml.njk +0 -495
- package/templates/blog.yaml.njk +0 -221
- package/templates/cli_command.yaml.njk +0 -37
- package/templates/footer.yaml.njk +0 -604
- package/templates/general.yaml.njk +0 -124
- package/templates/generateSitemap.js +0 -41
- package/templates/header.yaml +0 -138
- package/templates/navigation_buttons.yaml +0 -68
- package/templates/operators.yaml.njk +0 -82
- package/templates/operatorsMethodTransformer.js +0 -119
- package/templates/test/array.test.js +0 -1335
- package/templates/test/boolean.test.js +0 -98
- package/templates/test/button.test.js +0 -166
- package/templates/test/color.test.js +0 -126
- package/templates/test/enum.test.js +0 -105
- package/templates/test/icon.test.js +0 -109
- package/templates/test/integer.test.js +0 -99
- package/templates/test/manual.test.js +0 -238
- package/templates/test/number.test.js +0 -99
- package/templates/test/object.test.js +0 -434
- package/templates/test/oneOf.test.js +0 -794
- package/templates/test/string.test.js +0 -98
- package/templates/test/yaml.test.js +0 -605
- package/tutorial/next-steps.yaml +0 -83
- package/tutorial/tutorial-actions-operators-config.yaml +0 -142
- package/tutorial/tutorial-actions-operators.yaml +0 -436
- package/tutorial/tutorial-add-blocks-config.yaml +0 -109
- package/tutorial/tutorial-add-blocks.yaml +0 -195
- package/tutorial/tutorial-create-page-config.yaml +0 -77
- package/tutorial/tutorial-create-page.yaml +0 -196
- package/tutorial/tutorial-deploy.yaml +0 -146
- package/tutorial/tutorial-requests-config.yaml +0 -186
- package/tutorial/tutorial-requests.yaml +0 -338
- package/tutorial/tutorial-start.yaml +0 -282
- package/users/login-and-logout.yaml +0 -164
- package/users/openid-connect.yaml +0 -84
- package/users/protected-pages.yaml +0 -67
- package/users/roles.yaml +0 -70
- package/users/user-object.yaml +0 -73
- package/users/users-introduction.yaml +0 -80
- package/version.yaml +0 -1
package/connections/MongoDB.yaml
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
# Copyright 2020-2021 Lowdefy, Inc
|
|
2
|
-
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
_ref:
|
|
16
|
-
path: templates/general.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: MongoDB
|
|
19
|
-
pageTitle: MongoDB
|
|
20
|
-
section: Connections
|
|
21
|
-
filePath: connections/MongoDB.yaml
|
|
22
|
-
content:
|
|
23
|
-
- id: markdown
|
|
24
|
-
type: MarkdownWithCode
|
|
25
|
-
properties:
|
|
26
|
-
content: |
|
|
27
|
-
MongoDB is a NoSQL database that stores JSON-like documents. These documents are stored in collections, which are like database tables. The fields inside these document can differ from document to document, but generally they are all more or less the same. However documents with different schemas can be stored in the same collection.
|
|
28
|
-
|
|
29
|
-
##### ObjectIds
|
|
30
|
-
|
|
31
|
-
MongoDB uses the _id field as the id for a document. This has to be unique for every document in the collection. If no _id is provided when the document is created, a MongoDB [ObjectId](https://docs.mongodb.com/manual/reference/method/ObjectId/) is created for that document. This id includes a timestamp, a random element and an incrementing counter, to ensure it is unique even if multiple ids are created at the same time.
|
|
32
|
-
|
|
33
|
-
The _id is often represented as:
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
{
|
|
37
|
-
_id: ObjectId("507f1f77bcf86cd799439011")
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
To be able to transmit these ids over JSON network connections, and to use them in Lowdefy apps, Lowdefy serializes these ids as (in YAML):
|
|
42
|
-
```yaml
|
|
43
|
-
_id:
|
|
44
|
-
_oid: 507f1f77bcf86cd799439011
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Ids specified in this way will be treated as ObjectIds by MongoDB requests and mutations.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Connections
|
|
51
|
-
|
|
52
|
-
Connection types:
|
|
53
|
-
- MongoDBCollection
|
|
54
|
-
|
|
55
|
-
### MongoDBCollection
|
|
56
|
-
|
|
57
|
-
The `MongoDBCollection` connection sets up a connection to a MongoDB deployment. A [connection URI](https://docs.mongodb.com/manual/reference/connection-string/index.html) with authentication credentials (username and password) is required. The URI can be in the standard or dns seedlist (srv) formats. Connections are defined on a collection level, since this allows for read/write access control on a per collection level. Access control can also be managed using the roles in the database.
|
|
58
|
-
|
|
59
|
-
>Since the connection URI contains authentication secrets, it should be stored using the [`_secret`](operators/secret.md) operator.
|
|
60
|
-
|
|
61
|
-
#### Properties
|
|
62
|
-
- `databaseUri: string`: __Required__ - Connection uri string for the MongoDb deployment. Should be stored using the [_secret](operators/secret.md) operator.
|
|
63
|
-
- `databaseName: string`: Default: Database specified in connection string - The name of the database in the MongoDB deployment.
|
|
64
|
-
- `collection: string`: __Required__ - The name of the MongoDB collection.
|
|
65
|
-
- `read: boolean`: Default: `true` - Allow read operations like find on the collection.
|
|
66
|
-
- `write: boolean`: Default: `false` - Allow write operations like update on the collection.
|
|
67
|
-
- `options: object`: See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/interfaces/mongoclientoptions.html) for more information.
|
|
68
|
-
|
|
69
|
-
#### Examples
|
|
70
|
-
|
|
71
|
-
###### MongoDB collection with reads and writes:
|
|
72
|
-
```yaml
|
|
73
|
-
connections:
|
|
74
|
-
- id: my_collection
|
|
75
|
-
type: MongoDBCollection
|
|
76
|
-
properties:
|
|
77
|
-
databaseUri:
|
|
78
|
-
_secret: MONGODB_URI
|
|
79
|
-
collection: my_collection_name
|
|
80
|
-
write: true
|
|
81
|
-
```
|
|
82
|
-
Environment variables:
|
|
83
|
-
```
|
|
84
|
-
LOWDEFY_SECRET_MONGODB_URI = mongodb+srv://username:password@server.example.com/database
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Requests
|
|
88
|
-
|
|
89
|
-
Request types:
|
|
90
|
-
- MongoDBAggregation
|
|
91
|
-
- MongoDBDeleteMany
|
|
92
|
-
- MongoDBDeleteOne
|
|
93
|
-
- MongoDBFind
|
|
94
|
-
- MongoDBFindOne
|
|
95
|
-
- MongoDBInsertMany
|
|
96
|
-
- MongoDBInsertOne
|
|
97
|
-
- MongoDBUpdateMany
|
|
98
|
-
- MongoDBUpdateOne
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
### MongoDBAggregation
|
|
102
|
-
|
|
103
|
-
The `MongoDBAggregation` request executes an [aggregation pipeline](https://docs.mongodb.com/manual/core/aggregation-pipeline/) in the collection specified in the connectionId. It returns the array of documents returned by the aggregation. Aggregation pipelines are MongoDB's data processing and aggregation framework. They are based on a series of stages, each of which apply a transformation to the data passed through them, like sorting, grouping or calculating additional fields.
|
|
104
|
-
|
|
105
|
-
>Cursors are not supported. The request will return the whole body of the response as an array.
|
|
106
|
-
|
|
107
|
-
#### Properties
|
|
108
|
-
- `pipeline: object[]`: __Required__ - Array containing all the aggregation framework commands for the execution.
|
|
109
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#aggregate) for more information. Supported settings are:
|
|
110
|
-
- `allowDiskUse: boolean`: Default: `false` - Allow disk use on the MongoDB server to store temporary results for the aggregation.
|
|
111
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
112
|
-
- `batchSize: number`: The number of documents to return per batch.
|
|
113
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
114
|
-
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
115
|
-
- `checkKeys: boolean`: The serializer will check if keys are valid.
|
|
116
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
117
|
-
- `comment: string`: Add a [comment](https://docs.mongodb.com/manual/reference/operator/query/comment/index.html) to the aggregation. These comments are visible in the MongoDB profile log, making them easier to interpret.
|
|
118
|
-
- `dbName: string`: The database name.
|
|
119
|
-
- `explain: boolean`: Specifies to return the information on the processing of the pipeline.
|
|
120
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
121
|
-
- `hint: string | object`: Add an index selection hint to an aggregation command.
|
|
122
|
-
- `ignoreUndefined: boolean`: Default: `true` - Serialize will not emit undefined fields.
|
|
123
|
-
- `let: object`: Specifies an object with a list of variables. This allows you to improve command readability by separating the variables from the query text.
|
|
124
|
-
- `maxAwaitTimeMS: number`: The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.
|
|
125
|
-
- `maxTimeMS: number`: Specifies a cumulative time limit in milliseconds for processing operations on the cursor.
|
|
126
|
-
- `noResponse: boolean`: Admin command option.
|
|
127
|
-
- `readConcern: object`: Specifies the level of isolation for read operations.
|
|
128
|
-
- `readPreference: string | object`: The read preference.
|
|
129
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
130
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
131
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
132
|
-
- `writeConcern: object`: An object that expresses the write concern to use with the $out or $merge stage.
|
|
133
|
-
|
|
134
|
-
#### Examples
|
|
135
|
-
|
|
136
|
-
###### Calculate average score by region:
|
|
137
|
-
```yaml
|
|
138
|
-
requests:
|
|
139
|
-
- id: avg_spend_by_region
|
|
140
|
-
type: MongoDBAggregation
|
|
141
|
-
connectionId: my_mongodb_collection_id
|
|
142
|
-
properties:
|
|
143
|
-
pipeline:
|
|
144
|
-
- $group:
|
|
145
|
-
_id: $region
|
|
146
|
-
score:
|
|
147
|
-
$avg: $score
|
|
148
|
-
- $project:
|
|
149
|
-
_id: 0
|
|
150
|
-
region: $_id
|
|
151
|
-
score: 1
|
|
152
|
-
- $sort:
|
|
153
|
-
score: 1
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### MongoDBDeleteMany
|
|
157
|
-
|
|
158
|
-
The `MongoDBDeleteMany` request deletes multiple documents in the collection specified in the connectionId. It requires a filter, which is written in the query syntax, to select a documents to delete.
|
|
159
|
-
|
|
160
|
-
#### Properties
|
|
161
|
-
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
162
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#deletemany) for more information. Supported settings are:
|
|
163
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
164
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
165
|
-
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
166
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
167
|
-
- `comment: string`: A user-provided comment to attach to this command.
|
|
168
|
-
- `dbName: string`: The database name.
|
|
169
|
-
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
170
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
171
|
-
- `hint: string | object`: An optional hint for query optimization.
|
|
172
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
173
|
-
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
174
|
-
- `maxTimeMS: number`: Specifies a cumulative time limit in milliseconds for processing operations on the cursor.
|
|
175
|
-
- `noResponse: boolean`: Admin command option.
|
|
176
|
-
- `ordered: boolean`: If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
|
|
177
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
178
|
-
- `readPreference: string | object`: The read preference.
|
|
179
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
180
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
181
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
182
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
183
|
-
|
|
184
|
-
#### Examples
|
|
185
|
-
|
|
186
|
-
###### Delete all documents older than a specific date:
|
|
187
|
-
```yaml
|
|
188
|
-
requests:
|
|
189
|
-
- id: delete_old_documents
|
|
190
|
-
type: MongoDBDeleteMany
|
|
191
|
-
connectionId: my_mongodb_collection_id
|
|
192
|
-
properties:
|
|
193
|
-
filter:
|
|
194
|
-
created_date:
|
|
195
|
-
$lt:
|
|
196
|
-
_date: 2020-01-01
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### MongoDBDeleteOne
|
|
200
|
-
|
|
201
|
-
The `MongoDBDeleteOne` request deletes 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 delete. It will delete the first document that matches the filter.
|
|
202
|
-
|
|
203
|
-
#### Properties
|
|
204
|
-
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
205
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#deleteone) for more information. Supported settings are:
|
|
206
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
207
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
208
|
-
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
209
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
210
|
-
- `comment: string`: A user-provided comment to attach to this command.
|
|
211
|
-
- `dbName: string`: The database name.
|
|
212
|
-
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
213
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
214
|
-
- `hint: string | object`: An optional hint for query optimization.
|
|
215
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
216
|
-
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
217
|
-
- `maxTimeMS: number`: Specifies a cumulative time limit in milliseconds for processing operations on the cursor.
|
|
218
|
-
- `noResponse: boolean`: Admin command option.
|
|
219
|
-
- `ordered: boolean`: If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
|
|
220
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
221
|
-
- `readPreference: string | object`: The read preference.
|
|
222
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
223
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
224
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
225
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
226
|
-
|
|
227
|
-
#### Examples
|
|
228
|
-
|
|
229
|
-
###### Delete a document by _id:
|
|
230
|
-
```yaml
|
|
231
|
-
requests:
|
|
232
|
-
- id: delete_selected_document
|
|
233
|
-
type: MongoDBUpdateMany
|
|
234
|
-
connectionId: my_mongodb_collection_id
|
|
235
|
-
properties:
|
|
236
|
-
filter:
|
|
237
|
-
_id:
|
|
238
|
-
_state: selected_id
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### MongoDBFind
|
|
242
|
-
|
|
243
|
-
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.
|
|
244
|
-
|
|
245
|
-
>Cursors are not supported. The request will return the whole body of the response as an array.
|
|
246
|
-
|
|
247
|
-
#### Properties
|
|
248
|
-
- `query: object`: __Required__ - A MongoDB query object.
|
|
249
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#find) for more information. Supported settings are:
|
|
250
|
-
- `allowDiskUse: boolean`: Allows disk use for blocking sort operations exceeding 100MB memory. (MongoDB 3.2 or higher)
|
|
251
|
-
- `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.
|
|
252
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
253
|
-
- `awaitData: boolean`: Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true.
|
|
254
|
-
- `batchSize: number`: Set the batchSize for the getMoreCommand when iterating over the query results.
|
|
255
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
256
|
-
- `checkKeys: boolean`: The serializer will check if keys are valid.
|
|
257
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
258
|
-
- `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.
|
|
259
|
-
- `dbName: string`: The database name.
|
|
260
|
-
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
261
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
262
|
-
- `hint: string | object`: Tell the query to use specific indexes in the query. Object of indexes to use, `{'_id':1}`.
|
|
263
|
-
- `ignoreUndefined: boolean`: Default: `true` - Serialize will not emit undefined fields.
|
|
264
|
-
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
265
|
-
- `limit: number`: Sets the limit of documents returned in the query.
|
|
266
|
-
- `max: object`: The exclusive upper bound for a specific index.
|
|
267
|
-
- `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.
|
|
268
|
-
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
269
|
-
- `min: object`: The inclusive lower bound for a specific index.
|
|
270
|
-
- `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.
|
|
271
|
-
- `noResponse: boolean`: Admin command option.
|
|
272
|
-
- `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}`.
|
|
273
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
274
|
-
- `readPreference: string | object`: The preferred read preference.
|
|
275
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
276
|
-
- `returnKey: boolean`: If true, returns only the index keys in the resulting documents.
|
|
277
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
278
|
-
- `showRecordId: boolean`: Determine whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
|
|
279
|
-
- `singleBatch: boolean`: Default: `false` - Determines whether to close the cursor after the first batch.
|
|
280
|
-
- `skip: number`: Set to skip N documents ahead in your query (useful for pagination).
|
|
281
|
-
- `sort: array | object`: Set to sort the documents coming back from the query.
|
|
282
|
-
- `tailable: boolean`: Specify if the cursor is tailable.
|
|
283
|
-
- `timeout: boolean`: Specify if the cursor can timeout.
|
|
284
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
285
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
286
|
-
|
|
287
|
-
#### Examples
|
|
288
|
-
|
|
289
|
-
###### Find top ten scores above 90:
|
|
290
|
-
```yaml
|
|
291
|
-
requests:
|
|
292
|
-
- id: scores_top_ten_scores_above_90
|
|
293
|
-
type: MongoDBFind
|
|
294
|
-
connectionId: my_mongodb_collection_id
|
|
295
|
-
properties:
|
|
296
|
-
query:
|
|
297
|
-
score:
|
|
298
|
-
$gt: 90
|
|
299
|
-
options:
|
|
300
|
-
sort:
|
|
301
|
-
- - score
|
|
302
|
-
- -1
|
|
303
|
-
limit: 10
|
|
304
|
-
projection:
|
|
305
|
-
score: 1
|
|
306
|
-
name: 1
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### MongoDBFindOne
|
|
310
|
-
|
|
311
|
-
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.
|
|
312
|
-
|
|
313
|
-
>Cursors are not supported. The request will return the whole body of the response as an array.
|
|
314
|
-
|
|
315
|
-
#### Properties
|
|
316
|
-
- `query: object`: __Required__ - A MongoDB query object.
|
|
317
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#findone) for more information. Supported settings are:
|
|
318
|
-
- `allowDiskUse: boolean`: Allows disk use for blocking sort operations exceeding 100MB memory. (MongoDB 3.2 or higher)
|
|
319
|
-
- `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.
|
|
320
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
321
|
-
- `awaitData: boolean`: Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true.
|
|
322
|
-
- `batchSize: number`: Set the batchSize for the getMoreCommand when iterating over the query results.
|
|
323
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
324
|
-
- `checkKeys: boolean`: The serializer will check if keys are valid.
|
|
325
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
326
|
-
- `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.
|
|
327
|
-
- `dbName: string`: The database name.
|
|
328
|
-
- `explain: boolean`: Specifies the verbosity mode for the explain output.
|
|
329
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
330
|
-
- `hint: string | object`: Tell the query to use specific indexes in the query. Object of indexes to use, `{'_id':1}`.
|
|
331
|
-
- `ignoreUndefined: boolean`: Default: `true` - Serialize will not emit undefined fields.
|
|
332
|
-
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
333
|
-
- `limit: number`: Sets the limit of documents returned in the query.
|
|
334
|
-
- `max: object`: The exclusive upper bound for a specific index.
|
|
335
|
-
- `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.
|
|
336
|
-
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
337
|
-
- `min: object`: The inclusive lower bound for a specific index.
|
|
338
|
-
- `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.
|
|
339
|
-
- `noResponse: boolean`: Admin command option.
|
|
340
|
-
- `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}`.
|
|
341
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
342
|
-
- `readPreference: string | object`: The preferred read preference.
|
|
343
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
344
|
-
- `returnKey: boolean`: If true, returns only the index keys in the resulting documents.
|
|
345
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
346
|
-
- `showRecordId: boolean`: Determine whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
|
|
347
|
-
- `singleBatch: boolean`: Default: `false` - Determines whether to close the cursor after the first batch.
|
|
348
|
-
- `skip: number`: Set to skip N documents ahead in your query (useful for pagination).
|
|
349
|
-
- `sort: array | object`: Set to sort the documents coming back from the query.
|
|
350
|
-
- `tailable: boolean`: Specify if the cursor is tailable.
|
|
351
|
-
- `timeout: boolean`: Specify if the cursor can timeout.
|
|
352
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
353
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
354
|
-
|
|
355
|
-
#### Examples
|
|
356
|
-
|
|
357
|
-
###### Find a document by id:
|
|
358
|
-
```yaml
|
|
359
|
-
requests:
|
|
360
|
-
- id: find_by_id
|
|
361
|
-
type: MongoDBFindOne
|
|
362
|
-
connectionId: my_mongodb_collection_id
|
|
363
|
-
properties:
|
|
364
|
-
query:
|
|
365
|
-
_id:
|
|
366
|
-
_input: _id
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### MongoDBInsertMany
|
|
370
|
-
|
|
371
|
-
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.
|
|
372
|
-
|
|
373
|
-
#### Properties
|
|
374
|
-
- `docs: object[]`: __Required__ - The array of documents to be inserted.
|
|
375
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertmany) for more information. Supported settings are:
|
|
376
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
377
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
378
|
-
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher
|
|
379
|
-
- `checkKeys: boolean`: Default: `true` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
380
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
381
|
-
- `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.
|
|
382
|
-
- `dbName: string`: The database name.
|
|
383
|
-
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
384
|
-
- `forcesServerObjectId: boolean`: Default: `false` - Force server to assign _id values instead of driver.
|
|
385
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
386
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
387
|
-
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
388
|
-
- `noResponse: boolean`: Admin command option.
|
|
389
|
-
- `ordered: boolean`: If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
|
|
390
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
391
|
-
- `readPreference: object`: The preferred read preference.
|
|
392
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
393
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
394
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
395
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
396
|
-
|
|
397
|
-
#### Examples
|
|
398
|
-
|
|
399
|
-
###### Insert a set of documents:
|
|
400
|
-
```yaml
|
|
401
|
-
requests:
|
|
402
|
-
- id: insert_documents
|
|
403
|
-
type: MongoDBInsertMany
|
|
404
|
-
connectionId: my_mongodb_collection_id
|
|
405
|
-
properties:
|
|
406
|
-
docs:
|
|
407
|
-
- _id: 1
|
|
408
|
-
value: 4
|
|
409
|
-
- _id: 2
|
|
410
|
-
value: 1
|
|
411
|
-
- _id: 3
|
|
412
|
-
value: 7
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
### MongoDBInsertOne
|
|
417
|
-
|
|
418
|
-
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.
|
|
419
|
-
|
|
420
|
-
#### Properties
|
|
421
|
-
- `doc: object`: __Required__ - The document to be inserted.
|
|
422
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertone) for more information. Supported settings are:
|
|
423
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
424
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
425
|
-
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher
|
|
426
|
-
- `checkKeys: boolean`: Default: `true` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
427
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
428
|
-
- `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.
|
|
429
|
-
- `dbName: string`: The database name.
|
|
430
|
-
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
431
|
-
- `forcesServerObjectId: boolean`: Default: `false` - Force server to assign _id values instead of driver.
|
|
432
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
433
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
434
|
-
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
435
|
-
- `noResponse: boolean`: Admin command option.
|
|
436
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
437
|
-
- `readPreference: object`: The preferred read preference.
|
|
438
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
439
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
440
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
441
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
442
|
-
|
|
443
|
-
#### Examples
|
|
444
|
-
|
|
445
|
-
###### Insert a document:
|
|
446
|
-
```yaml
|
|
447
|
-
requests:
|
|
448
|
-
- id: insert_new_comment
|
|
449
|
-
type: MongoDBInsertOne
|
|
450
|
-
connectionId: my_mongodb_collection_id
|
|
451
|
-
properties:
|
|
452
|
-
doc:
|
|
453
|
-
comment:
|
|
454
|
-
_state: comment_input
|
|
455
|
-
user_id:
|
|
456
|
-
_user: id
|
|
457
|
-
timestamp:
|
|
458
|
-
_date: now
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### MongoDBUpdateMany
|
|
462
|
-
|
|
463
|
-
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.
|
|
464
|
-
|
|
465
|
-
#### Properties
|
|
466
|
-
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
467
|
-
- `update: object | object[]`: __Required__ - The update operations to be applied to the document.
|
|
468
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#updateOne) for more information. Supported settings are:
|
|
469
|
-
- `arrayFilters: string[]`: Array filters for the [`$[<identifier>]`](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) array update operator.
|
|
470
|
-
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
471
|
-
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
472
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
473
|
-
- `forceServerObjectId: boolean`: Force server to assign _id values instead of driver.
|
|
474
|
-
- `hint: object`: An optional hint for query optimization.
|
|
475
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
476
|
-
- `j: boolean`: Specify a journal write concern.
|
|
477
|
-
- `upsert: boolean`: Default: `false` - Insert document if no match is found.
|
|
478
|
-
- `w: number | string`: The write concern.
|
|
479
|
-
- `wtimeout: number`: The write concern timeout.
|
|
480
|
-
|
|
481
|
-
#### Examples
|
|
482
|
-
|
|
483
|
-
###### Set a list of documents as resolved:
|
|
484
|
-
```yaml
|
|
485
|
-
requests:
|
|
486
|
-
- id: set_resolved
|
|
487
|
-
type: MongoDBUpdateMany
|
|
488
|
-
connectionId: my_mongodb_collection_id
|
|
489
|
-
properties:
|
|
490
|
-
# Select all documents where the _id is in selected_issues_list in state
|
|
491
|
-
filter:
|
|
492
|
-
_id:
|
|
493
|
-
$in:
|
|
494
|
-
_state: selected_issues_list
|
|
495
|
-
update:
|
|
496
|
-
$set:
|
|
497
|
-
resolved: true
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
###### Mark all documents with score less than 6 as urgent:
|
|
501
|
-
```yaml
|
|
502
|
-
requests:
|
|
503
|
-
- id: set_resolved
|
|
504
|
-
type: MongoDBUpdateMany
|
|
505
|
-
properties:
|
|
506
|
-
filter:
|
|
507
|
-
score:
|
|
508
|
-
$lt: 6
|
|
509
|
-
update:
|
|
510
|
-
$set:
|
|
511
|
-
status: urgent
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### MongoDBUpdateOne
|
|
515
|
-
|
|
516
|
-
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.
|
|
517
|
-
|
|
518
|
-
#### Properties
|
|
519
|
-
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
520
|
-
- `update: object | object[]`: __Required__ - The update operations to be applied to the document.
|
|
521
|
-
- `options: object`: Optional settings. See the [driver docs](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#updateone) for more information. Supported settings are:
|
|
522
|
-
- `arrayFilters: object[]`: _Array_ - Array filters for the [`$[<identifier>]`](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) array update operator.
|
|
523
|
-
- `authdb: string`: Specifies the authentication information to be used.
|
|
524
|
-
- `bsonRegExp: boolean`: Return the BSON regular expressions as BSONRegExp instances.
|
|
525
|
-
- `bypassDocumentValidation: boolean`: Default: `false` - Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
526
|
-
- `checkKeys: boolean`: Default: `false` - If true, will throw if bson documents start with $ or include a . in any key value.
|
|
527
|
-
- `collation: object`: Specify collation (MongoDB 3.4 or higher) settings for update operation.
|
|
528
|
-
- `comment: string | object`: A user-provided comment to attach to this command.
|
|
529
|
-
- `dbName: string`: The database name.
|
|
530
|
-
- `explain: object`: Specifies the verbosity mode for the explain output.
|
|
531
|
-
- `fullResponse: boolean`: Return the full server response for the command.
|
|
532
|
-
- `hint: string | object`: An optional hint for query optimization.
|
|
533
|
-
- `ignoreUndefined: boolean`: Default: `false` - Specify if the BSON serializer should ignore undefined fields.
|
|
534
|
-
- `let: object`: Map of parameter names and values that can be accessed using `$$var` (requires MongoDB 5.0).
|
|
535
|
-
- `maxTimeMS: number`: Number of milliseconds to wait before aborting the command.
|
|
536
|
-
- `noResponse: boolean`: Admin command option.
|
|
537
|
-
- `readConcern: object`: Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported).
|
|
538
|
-
- `readPreference: object`: The preferred read preference.
|
|
539
|
-
- `retryWrites: boolean`: Should retry failed writes.
|
|
540
|
-
- `serializeFunctions: boolean`: Default: `false` - Serialize the javascript functions.
|
|
541
|
-
- `upsert: boolean`: Default: `false` - Insert document if no match is found.
|
|
542
|
-
- `willRetryWrites: boolean`: Option whether to retry writes.
|
|
543
|
-
- `writeConcern: object`: An object that expresses the write concern.
|
|
544
|
-
|
|
545
|
-
#### Examples
|
|
546
|
-
|
|
547
|
-
###### Update a document:
|
|
548
|
-
```yaml
|
|
549
|
-
requests:
|
|
550
|
-
- id: update
|
|
551
|
-
type: MongoDBUpdateOne
|
|
552
|
-
connectionId: my_mongodb_collection_id
|
|
553
|
-
properties:
|
|
554
|
-
filter:
|
|
555
|
-
_id:
|
|
556
|
-
_state: _id
|
|
557
|
-
update:
|
|
558
|
-
$set:
|
|
559
|
-
_state: true
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
Like a comment:
|
|
563
|
-
```yaml
|
|
564
|
-
requests:
|
|
565
|
-
- id: like_comment
|
|
566
|
-
type: MongoDBUpdateOne
|
|
567
|
-
connectionId: my_mongodb_collection_id
|
|
568
|
-
properties:
|
|
569
|
-
filter:
|
|
570
|
-
_id:
|
|
571
|
-
_state: comments.$_id
|
|
572
|
-
update:
|
|
573
|
-
$inc:
|
|
574
|
-
likes: 1
|
|
575
|
-
$push:
|
|
576
|
-
liked_by:
|
|
577
|
-
_user.id:
|
|
578
|
-
$set:
|
|
579
|
-
last_liked:
|
|
580
|
-
_date: now
|
|
581
|
-
```
|