@sfxcode/nuxt-mongocamp-server 2.1.0 → 2.3.0
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/README.md +71 -19
- package/dist/module.d.mts +16 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +103 -11
- package/dist/runtime/api/.openapi-generator/FILES +24 -2
- package/dist/runtime/api/apis/CollectionApi.d.ts +137 -0
- package/dist/runtime/api/apis/CollectionApi.js +213 -0
- package/dist/runtime/api/apis/DocumentApi.d.ts +225 -8
- package/dist/runtime/api/apis/DocumentApi.js +364 -5
- package/dist/runtime/api/docs/AuditEntry.md +52 -0
- package/dist/runtime/api/docs/CollectionApi.md +272 -2
- package/dist/runtime/api/docs/CollectionDeclaration.md +52 -0
- package/dist/runtime/api/docs/CollectionDeclarationAudit.md +34 -0
- package/dist/runtime/api/docs/CollectionDeclarationOwner.md +36 -0
- package/dist/runtime/api/docs/CollectionDeclarationSoftDelete.md +36 -0
- package/dist/runtime/api/docs/CollectionDeclarationTimestamps.md +40 -0
- package/dist/runtime/api/docs/CollectionDeclarationVersioned.md +38 -0
- package/dist/runtime/api/docs/CountRequest.md +34 -0
- package/dist/runtime/api/docs/DocumentApi.md +467 -12
- package/dist/runtime/api/docs/ErrorDescription.md +4 -0
- package/dist/runtime/api/docs/ExportRequest.md +40 -0
- package/dist/runtime/api/docs/MongoAggregateRequest.md +2 -0
- package/dist/runtime/api/docs/SettingsResponse.md +0 -6
- package/dist/runtime/api/docs/SuggestedValidator.md +40 -0
- package/dist/runtime/api/docs/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
- package/dist/runtime/api/docs/ValidationIssue.md +36 -0
- package/dist/runtime/api/models/AuditEntry.d.ts +88 -0
- package/dist/runtime/api/models/AuditEntry.js +56 -0
- package/dist/runtime/api/models/CollectionDeclaration.d.ts +80 -0
- package/dist/runtime/api/models/CollectionDeclaration.js +73 -0
- package/dist/runtime/api/models/CollectionDeclarationAudit.d.ts +30 -0
- package/dist/runtime/api/models/CollectionDeclarationAudit.js +26 -0
- package/dist/runtime/api/models/CollectionDeclarationOwner.d.ts +43 -0
- package/dist/runtime/api/models/CollectionDeclarationOwner.js +34 -0
- package/dist/runtime/api/models/CollectionDeclarationSoftDelete.d.ts +34 -0
- package/dist/runtime/api/models/CollectionDeclarationSoftDelete.js +28 -0
- package/dist/runtime/api/models/CollectionDeclarationTimestamps.d.ts +42 -0
- package/dist/runtime/api/models/CollectionDeclarationTimestamps.js +33 -0
- package/dist/runtime/api/models/CollectionDeclarationVersioned.d.ts +46 -0
- package/dist/runtime/api/models/CollectionDeclarationVersioned.js +36 -0
- package/dist/runtime/api/models/CountRequest.d.ts +30 -0
- package/dist/runtime/api/models/CountRequest.js +25 -0
- package/dist/runtime/api/models/ErrorDescription.d.ts +11 -0
- package/dist/runtime/api/models/ErrorDescription.js +10 -2
- package/dist/runtime/api/models/ExportRequest.d.ts +42 -0
- package/dist/runtime/api/models/ExportRequest.js +31 -0
- package/dist/runtime/api/models/Grant.d.ts +10 -1
- package/dist/runtime/api/models/Grant.js +5 -0
- package/dist/runtime/api/models/MongoAggregateRequest.d.ts +4 -0
- package/dist/runtime/api/models/MongoAggregateRequest.js +4 -2
- package/dist/runtime/api/models/SettingsResponse.d.ts +0 -14
- package/dist/runtime/api/models/SettingsResponse.js +0 -6
- package/dist/runtime/api/models/SuggestedValidator.d.ts +44 -0
- package/dist/runtime/api/models/SuggestedValidator.js +35 -0
- package/dist/runtime/api/models/UpdateManyRequest.d.ts +38 -0
- package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
- package/dist/runtime/api/models/ValidationIssue.d.ts +34 -0
- package/dist/runtime/api/models/ValidationIssue.js +29 -0
- package/dist/runtime/api/models/index.d.ts +12 -1
- package/dist/runtime/api/models/index.js +12 -1
- package/dist/runtime/composables/mongocampApiCollection.d.ts +14 -15
- package/dist/runtime/composables/mongocampApiCollection.js +4 -1
- package/dist/runtime/composables/mongocampCollection.d.ts +106 -0
- package/dist/runtime/composables/mongocampCollection.js +200 -0
- package/dist/runtime/composables/mongocampLive.d.ts +33 -0
- package/dist/runtime/composables/mongocampLive.js +152 -0
- package/dist/runtime/composables/mongocampSearch.d.ts +12 -9
- package/dist/runtime/server/mongocamp/core.d.ts +2 -0
- package/dist/runtime/server/mongocamp/core.js +8 -1
- package/dist/runtime/server/mongocamp/plugin.d.ts +5 -1
- package/dist/runtime/server/mongocamp/plugin.js +21 -1
- package/dist/runtime/types/collections.d.ts +20 -0
- package/dist/runtime/types/collections.js +0 -0
- package/dist/runtime/utils/sse.d.ts +10 -0
- package/dist/runtime/utils/sse.js +33 -0
- package/dist/runtime/utils/toMongocampError.d.ts +7 -0
- package/dist/runtime/utils/toMongocampError.js +18 -1
- package/dist/types.d.mts +6 -0
- package/package.json +4 -3
- package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
|
@@ -6,18 +6,23 @@ All URIs are relative to *http://localhost*
|
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
7
|
| [**_delete**](DocumentApi.md#_delete) | **DELETE** /mongodb/collections/{collectionName}/documents/{documentId} | Delete Document from Collection |
|
|
8
8
|
| [**countDocuments**](DocumentApi.md#countdocuments) | **GET** /mongodb/collections/{collectionName}/documents/count | Count Documents in Collection |
|
|
9
|
+
| [**countDocumentsByBody**](DocumentApi.md#countdocumentsbybody) | **POST** /mongodb/collections/{collectionName}/documents/count | Count Documents in Collection (filter in the body) |
|
|
9
10
|
| [**deleteMany**](DocumentApi.md#deletemany) | **DELETE** /mongodb/collections/{collectionName}/documents/many/delete | Delete Many in Collection |
|
|
10
11
|
| [**exportDocuments**](DocumentApi.md#exportdocuments) | **GET** /mongodb/collections/{collectionName}/documents/export | Export Documents of a Collection |
|
|
12
|
+
| [**exportDocumentsByBody**](DocumentApi.md#exportdocumentsbybody) | **POST** /mongodb/collections/{collectionName}/documents/export | Export Documents of a Collection (filter in the body) |
|
|
11
13
|
| [**find**](DocumentApi.md#find) | **POST** /mongodb/collections/{collectionName}/documents | Documents in Collection |
|
|
12
14
|
| [**getDocument**](DocumentApi.md#getdocument) | **GET** /mongodb/collections/{collectionName}/documents/{documentId} | Document from Collection |
|
|
15
|
+
| [**getDocumentHistory**](DocumentApi.md#getdocumenthistory) | **GET** /mongodb/collections/{collectionName}/documents/{documentId}/history | History of a Document |
|
|
13
16
|
| [**importDocuments**](DocumentApi.md#importdocuments) | **POST** /mongodb/collections/{collectionName}/documents/import | Import Documents into a Collection |
|
|
14
17
|
| [**insert**](DocumentApi.md#insert) | **PUT** /mongodb/collections/{collectionName}/documents | Insert Document |
|
|
15
18
|
| [**insertMany**](DocumentApi.md#insertmany) | **PUT** /mongodb/collections/{collectionName}/documents/many/insert | Insert many Documents |
|
|
16
19
|
| [**listDocuments**](DocumentApi.md#listdocuments) | **GET** /mongodb/collections/{collectionName}/documents | Documents in Collection |
|
|
20
|
+
| [**restoreDocument**](DocumentApi.md#restoredocument) | **POST** /mongodb/collections/{collectionName}/documents/{documentId}/restore | Restore a soft-deleted Document |
|
|
17
21
|
| [**searchDocuments**](DocumentApi.md#searchdocuments) | **POST** /mongodb/collections/{collectionName}/documents/search | Search Documents in Collection |
|
|
18
22
|
| [**update**](DocumentApi.md#update) | **PATCH** /mongodb/collections/{collectionName}/documents/{documentId} | Update Document in Collection |
|
|
19
23
|
| [**updateDocumentPartial**](DocumentApi.md#updatedocumentpartial) | **PATCH** /mongodb/collections/{collectionName}/documents/{documentId}/partial | Update Document Parts in Collection |
|
|
20
|
-
| [**updateMany**](DocumentApi.md#
|
|
24
|
+
| [**updateMany**](DocumentApi.md#updatemanyoperation) | **PATCH** /mongodb/collections/{collectionName}/documents/many/update | Update many in Collection |
|
|
25
|
+
| [**watchDocuments**](DocumentApi.md#watchdocuments) | **GET** /mongodb/collections/{collectionName}/documents/watch | Live Updates of a Collection |
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
|
|
@@ -103,7 +108,7 @@ example().catch(console.error);
|
|
|
103
108
|
|
|
104
109
|
## countDocuments
|
|
105
110
|
|
|
106
|
-
> CountResponse countDocuments(collectionName, filter, filterCaseInsensitive)
|
|
111
|
+
> CountResponse countDocuments(collectionName, withDeleted, filter, filterCaseInsensitive)
|
|
107
112
|
|
|
108
113
|
Count Documents in Collection
|
|
109
114
|
|
|
@@ -134,6 +139,8 @@ async function example() {
|
|
|
134
139
|
const body = {
|
|
135
140
|
// string | The name of your MongoDb Collection
|
|
136
141
|
collectionName: collectionName_example,
|
|
142
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
143
|
+
withDeleted: true,
|
|
137
144
|
// string | Filter Query like on the list of documents, by default all documents are counted (optional)
|
|
138
145
|
filter: filter_example,
|
|
139
146
|
// boolean | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* (optional)
|
|
@@ -158,6 +165,7 @@ example().catch(console.error);
|
|
|
158
165
|
| Name | Type | Description | Notes |
|
|
159
166
|
|------------- | ------------- | ------------- | -------------|
|
|
160
167
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
168
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
161
169
|
| **filter** | `string` | Filter Query like on the list of documents, by default all documents are counted | [Optional] [Defaults to `undefined`] |
|
|
162
170
|
| **filterCaseInsensitive** | `boolean` | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* | [Optional] [Defaults to `false`] |
|
|
163
171
|
|
|
@@ -184,6 +192,92 @@ example().catch(console.error);
|
|
|
184
192
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
185
193
|
|
|
186
194
|
|
|
195
|
+
## countDocumentsByBody
|
|
196
|
+
|
|
197
|
+
> CountResponse countDocumentsByBody(collectionName, countRequest, withDeleted, filterCaseInsensitive)
|
|
198
|
+
|
|
199
|
+
Count Documents in Collection (filter in the body)
|
|
200
|
+
|
|
201
|
+
Count the Documents of the given Collection that match the filter without loading them
|
|
202
|
+
|
|
203
|
+
### Example
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import {
|
|
207
|
+
Configuration,
|
|
208
|
+
DocumentApi,
|
|
209
|
+
} from '';
|
|
210
|
+
import type { CountDocumentsByBodyRequest } from '';
|
|
211
|
+
|
|
212
|
+
async function example() {
|
|
213
|
+
console.log("🚀 Testing SDK...");
|
|
214
|
+
const config = new Configuration({
|
|
215
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
216
|
+
username: "YOUR USERNAME",
|
|
217
|
+
password: "YOUR PASSWORD",
|
|
218
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
219
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
220
|
+
// To configure API key authorization: apiKeyAuth
|
|
221
|
+
apiKey: "YOUR API KEY",
|
|
222
|
+
});
|
|
223
|
+
const api = new DocumentApi(config);
|
|
224
|
+
|
|
225
|
+
const body = {
|
|
226
|
+
// string | The name of your MongoDb Collection
|
|
227
|
+
collectionName: collectionName_example,
|
|
228
|
+
// CountRequest
|
|
229
|
+
countRequest: {"filter":"country:DE"},
|
|
230
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
231
|
+
withDeleted: true,
|
|
232
|
+
// boolean | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* (optional)
|
|
233
|
+
filterCaseInsensitive: false,
|
|
234
|
+
} satisfies CountDocumentsByBodyRequest;
|
|
235
|
+
|
|
236
|
+
try {
|
|
237
|
+
const data = await api.countDocumentsByBody(body);
|
|
238
|
+
console.log(data);
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error(error);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Run the test
|
|
245
|
+
example().catch(console.error);
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Parameters
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
| Name | Type | Description | Notes |
|
|
252
|
+
|------------- | ------------- | ------------- | -------------|
|
|
253
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
254
|
+
| **countRequest** | [CountRequest](CountRequest.md) | | |
|
|
255
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
256
|
+
| **filterCaseInsensitive** | `boolean` | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* | [Optional] [Defaults to `false`] |
|
|
257
|
+
|
|
258
|
+
### Return type
|
|
259
|
+
|
|
260
|
+
[**CountResponse**](CountResponse.md)
|
|
261
|
+
|
|
262
|
+
### Authorization
|
|
263
|
+
|
|
264
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
265
|
+
|
|
266
|
+
### HTTP request headers
|
|
267
|
+
|
|
268
|
+
- **Content-Type**: `application/json`
|
|
269
|
+
- **Accept**: `application/json`
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
### HTTP response details
|
|
273
|
+
| Status code | Description | Response headers |
|
|
274
|
+
|-------------|-------------|------------------|
|
|
275
|
+
| **200** | | - |
|
|
276
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
277
|
+
|
|
278
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
279
|
+
|
|
280
|
+
|
|
187
281
|
## deleteMany
|
|
188
282
|
|
|
189
283
|
> DeleteResponse deleteMany(collectionName, requestBody, matchAll, filter, filterCaseInsensitive)
|
|
@@ -276,11 +370,11 @@ example().catch(console.error);
|
|
|
276
370
|
|
|
277
371
|
## exportDocuments
|
|
278
372
|
|
|
279
|
-
> string exportDocuments(collectionName, format, filter, sort, projection, limit, extendedJson, filterCaseInsensitive)
|
|
373
|
+
> string exportDocuments(collectionName, withDeleted, format, filter, sort, projection, limit, extendedJson, filterCaseInsensitive, trailer)
|
|
280
374
|
|
|
281
375
|
Export Documents of a Collection
|
|
282
376
|
|
|
283
|
-
Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then.
|
|
377
|
+
Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
284
378
|
|
|
285
379
|
### Example
|
|
286
380
|
|
|
@@ -307,6 +401,8 @@ async function example() {
|
|
|
307
401
|
const body = {
|
|
308
402
|
// string | The name of your MongoDb Collection
|
|
309
403
|
collectionName: collectionName_example,
|
|
404
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
405
|
+
withDeleted: true,
|
|
310
406
|
// string | ndjson (one JSON document per line), json (one array) or csv (optional)
|
|
311
407
|
format: format_example,
|
|
312
408
|
// string | Filter Query like on the list of documents, by default all documents are exported (optional)
|
|
@@ -321,6 +417,8 @@ async function example() {
|
|
|
321
417
|
extendedJson: extendedJson_example,
|
|
322
418
|
// boolean | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* (optional)
|
|
323
419
|
filterCaseInsensitive: false,
|
|
420
|
+
// boolean | true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {\"$end\":true,\"count\":n}, or {\"$error\":\"...\"} when the stream fails; json: the array is followed by nothing on success and the stream ends without \"]\" on failure (the marker is the closing bracket); csv: a last line \"# end n\" or \"# error ...\". Default false (optional)
|
|
421
|
+
trailer: false,
|
|
324
422
|
} satisfies ExportDocumentsRequest;
|
|
325
423
|
|
|
326
424
|
try {
|
|
@@ -341,6 +439,7 @@ example().catch(console.error);
|
|
|
341
439
|
| Name | Type | Description | Notes |
|
|
342
440
|
|------------- | ------------- | ------------- | -------------|
|
|
343
441
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
442
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
344
443
|
| **format** | `string` | ndjson (one JSON document per line), json (one array) or csv | [Optional] [Defaults to `'ndjson'`] |
|
|
345
444
|
| **filter** | `string` | Filter Query like on the list of documents, by default all documents are exported | [Optional] [Defaults to `undefined`] |
|
|
346
445
|
| **sort** | `Array<string>` | Sorting like on the list of documents, a leading - sorts descending | [Optional] |
|
|
@@ -348,6 +447,7 @@ example().catch(console.error);
|
|
|
348
447
|
| **limit** | `number` | The greatest number of documents, by default all | [Optional] [Defaults to `undefined`] |
|
|
349
448
|
| **extendedJson** | `relaxed`, `canonical`, `plain` | relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({\"$oid\": ...}, {\"$date\": ...}, {\"$numberDecimal\": ...}; canonical also {\"$numberInt\": ...}, {\"$numberLong\": ...} and {\"$numberDouble\": ...}); a text that looks like a date is {\"$string\": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). The default of a csv export is plain. | [Optional] [Defaults to `'relaxed'`] [Enum: relaxed, canonical, plain] |
|
|
350
449
|
| **filterCaseInsensitive** | `boolean` | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* | [Optional] [Defaults to `false`] |
|
|
450
|
+
| **trailer** | `boolean` | true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {\"$end\":true,\"count\":n}, or {\"$error\":\"...\"} when the stream fails; json: the array is followed by nothing on success and the stream ends without \"]\" on failure (the marker is the closing bracket); csv: a last line \"# end n\" or \"# error ...\". Default false | [Optional] [Defaults to `false`] |
|
|
351
451
|
|
|
352
452
|
### Return type
|
|
353
453
|
|
|
@@ -373,9 +473,105 @@ example().catch(console.error);
|
|
|
373
473
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
374
474
|
|
|
375
475
|
|
|
476
|
+
## exportDocumentsByBody
|
|
477
|
+
|
|
478
|
+
> string exportDocumentsByBody(collectionName, exportRequest, withDeleted, format, extendedJson, filterCaseInsensitive, trailer)
|
|
479
|
+
|
|
480
|
+
Export Documents of a Collection (filter in the body)
|
|
481
|
+
|
|
482
|
+
Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
483
|
+
|
|
484
|
+
### Example
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
import {
|
|
488
|
+
Configuration,
|
|
489
|
+
DocumentApi,
|
|
490
|
+
} from '';
|
|
491
|
+
import type { ExportDocumentsByBodyRequest } from '';
|
|
492
|
+
|
|
493
|
+
async function example() {
|
|
494
|
+
console.log("🚀 Testing SDK...");
|
|
495
|
+
const config = new Configuration({
|
|
496
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
497
|
+
username: "YOUR USERNAME",
|
|
498
|
+
password: "YOUR PASSWORD",
|
|
499
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
500
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
501
|
+
// To configure API key authorization: apiKeyAuth
|
|
502
|
+
apiKey: "YOUR API KEY",
|
|
503
|
+
});
|
|
504
|
+
const api = new DocumentApi(config);
|
|
505
|
+
|
|
506
|
+
const body = {
|
|
507
|
+
// string | The name of your MongoDb Collection
|
|
508
|
+
collectionName: collectionName_example,
|
|
509
|
+
// ExportRequest
|
|
510
|
+
exportRequest: {"filter":"country:DE AND age:[18 TO 65]","sort":["-age"],"projection":["name","age"]},
|
|
511
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
512
|
+
withDeleted: true,
|
|
513
|
+
// string | ndjson (one JSON document per line), json (one array) or csv (optional)
|
|
514
|
+
format: format_example,
|
|
515
|
+
// 'relaxed' | 'canonical' | 'plain' | relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({\"$oid\": ...}, {\"$date\": ...}, {\"$numberDecimal\": ...}; canonical also {\"$numberInt\": ...}, {\"$numberLong\": ...} and {\"$numberDouble\": ...}); a text that looks like a date is {\"$string\": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). The default of a csv export is plain. (optional)
|
|
516
|
+
extendedJson: extendedJson_example,
|
|
517
|
+
// boolean | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* (optional)
|
|
518
|
+
filterCaseInsensitive: false,
|
|
519
|
+
// boolean | true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {\"$end\":true,\"count\":n}, or {\"$error\":\"...\"} when the stream fails; json: the array is followed by nothing on success and the stream ends without \"]\" on failure (the marker is the closing bracket); csv: a last line \"# end n\" or \"# error ...\". Default false (optional)
|
|
520
|
+
trailer: false,
|
|
521
|
+
} satisfies ExportDocumentsByBodyRequest;
|
|
522
|
+
|
|
523
|
+
try {
|
|
524
|
+
const data = await api.exportDocumentsByBody(body);
|
|
525
|
+
console.log(data);
|
|
526
|
+
} catch (error) {
|
|
527
|
+
console.error(error);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Run the test
|
|
532
|
+
example().catch(console.error);
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Parameters
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
| Name | Type | Description | Notes |
|
|
539
|
+
|------------- | ------------- | ------------- | -------------|
|
|
540
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
541
|
+
| **exportRequest** | [ExportRequest](ExportRequest.md) | | |
|
|
542
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
543
|
+
| **format** | `string` | ndjson (one JSON document per line), json (one array) or csv | [Optional] [Defaults to `'ndjson'`] |
|
|
544
|
+
| **extendedJson** | `relaxed`, `canonical`, `plain` | relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({\"$oid\": ...}, {\"$date\": ...}, {\"$numberDecimal\": ...}; canonical also {\"$numberInt\": ...}, {\"$numberLong\": ...} and {\"$numberDouble\": ...}); a text that looks like a date is {\"$string\": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). The default of a csv export is plain. | [Optional] [Defaults to `'relaxed'`] [Enum: relaxed, canonical, plain] |
|
|
545
|
+
| **filterCaseInsensitive** | `boolean` | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* | [Optional] [Defaults to `false`] |
|
|
546
|
+
| **trailer** | `boolean` | true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {\"$end\":true,\"count\":n}, or {\"$error\":\"...\"} when the stream fails; json: the array is followed by nothing on success and the stream ends without \"]\" on failure (the marker is the closing bracket); csv: a last line \"# end n\" or \"# error ...\". Default false | [Optional] [Defaults to `false`] |
|
|
547
|
+
|
|
548
|
+
### Return type
|
|
549
|
+
|
|
550
|
+
**string**
|
|
551
|
+
|
|
552
|
+
### Authorization
|
|
553
|
+
|
|
554
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
555
|
+
|
|
556
|
+
### HTTP request headers
|
|
557
|
+
|
|
558
|
+
- **Content-Type**: `application/json`
|
|
559
|
+
- **Accept**: `text/plain`, `application/json`
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
### HTTP response details
|
|
563
|
+
| Status code | Description | Response headers |
|
|
564
|
+
|-------------|-------------|------------------|
|
|
565
|
+
| **200** | | * Content-Disposition - <br> |
|
|
566
|
+
| **400** | Invalid value for: query parameter limit | - |
|
|
567
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
568
|
+
|
|
569
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
570
|
+
|
|
571
|
+
|
|
376
572
|
## find
|
|
377
573
|
|
|
378
|
-
> Array<{ [key: string]: any | null; }> find(collectionName, mongoFindRequest, rowsPerPage, page, count, after, extendedJson)
|
|
574
|
+
> Array<{ [key: string]: any | null; }> find(collectionName, mongoFindRequest, withDeleted, rowsPerPage, page, count, after, extendedJson)
|
|
379
575
|
|
|
380
576
|
Documents in Collection
|
|
381
577
|
|
|
@@ -408,6 +604,8 @@ async function example() {
|
|
|
408
604
|
collectionName: collectionName_example,
|
|
409
605
|
// MongoFindRequest
|
|
410
606
|
mongoFindRequest: {"filter":{"additionalProp1":"string","additionalProp2":123},"sort":{"additionalProp2":-1},"projection":{"additionalProp1":1,"additionalProp2":1}},
|
|
607
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
608
|
+
withDeleted: true,
|
|
411
609
|
// number | Count elements per page (optional)
|
|
412
610
|
rowsPerPage: 100,
|
|
413
611
|
// number | Requested page of the ResultSets (optional)
|
|
@@ -439,6 +637,7 @@ example().catch(console.error);
|
|
|
439
637
|
|------------- | ------------- | ------------- | -------------|
|
|
440
638
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
441
639
|
| **mongoFindRequest** | [MongoFindRequest](MongoFindRequest.md) | | |
|
|
640
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
442
641
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
443
642
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
444
643
|
| **count** | `exact`, `none` | How the result is counted: exact (default) or none (no count headers, no count query) | [Optional] [Defaults to `'exact'`] [Enum: exact, none] |
|
|
@@ -471,7 +670,7 @@ example().catch(console.error);
|
|
|
471
670
|
|
|
472
671
|
## getDocument
|
|
473
672
|
|
|
474
|
-
> { [key: string]: any | null; } getDocument(collectionName, documentId, extendedJson)
|
|
673
|
+
> { [key: string]: any | null; } getDocument(collectionName, documentId, withDeleted, extendedJson)
|
|
475
674
|
|
|
476
675
|
Document from Collection
|
|
477
676
|
|
|
@@ -504,6 +703,8 @@ async function example() {
|
|
|
504
703
|
collectionName: collectionName_example,
|
|
505
704
|
// string | DocumentId to read
|
|
506
705
|
documentId: documentId_example,
|
|
706
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
707
|
+
withDeleted: true,
|
|
507
708
|
// 'relaxed' | 'canonical' | 'plain' | relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({\"$oid\": ...}, {\"$date\": ...}, {\"$numberDecimal\": ...}; canonical also {\"$numberInt\": ...}, {\"$numberLong\": ...} and {\"$numberDouble\": ...}); a text that looks like a date is {\"$string\": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). (optional)
|
|
508
709
|
extendedJson: extendedJson_example,
|
|
509
710
|
} satisfies GetDocumentRequest;
|
|
@@ -527,6 +728,7 @@ example().catch(console.error);
|
|
|
527
728
|
|------------- | ------------- | ------------- | -------------|
|
|
528
729
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
529
730
|
| **documentId** | `string` | DocumentId to read | [Defaults to `undefined`] |
|
|
731
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
530
732
|
| **extendedJson** | `relaxed`, `canonical`, `plain` | relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({\"$oid\": ...}, {\"$date\": ...}, {\"$numberDecimal\": ...}; canonical also {\"$numberInt\": ...}, {\"$numberLong\": ...} and {\"$numberDouble\": ...}); a text that looks like a date is {\"$string\": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). | [Optional] [Defaults to `'relaxed'`] [Enum: relaxed, canonical, plain] |
|
|
531
733
|
|
|
532
734
|
### Return type
|
|
@@ -552,6 +754,96 @@ example().catch(console.error);
|
|
|
552
754
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
553
755
|
|
|
554
756
|
|
|
757
|
+
## getDocumentHistory
|
|
758
|
+
|
|
759
|
+
> Array<AuditEntry> getDocumentHistory(collectionName, documentId, rowsPerPage, page, extendedJson)
|
|
760
|
+
|
|
761
|
+
History of a Document
|
|
762
|
+
|
|
763
|
+
The audit records of a document of a collection declared with audit, newest first (2.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
|
|
764
|
+
|
|
765
|
+
### Example
|
|
766
|
+
|
|
767
|
+
```ts
|
|
768
|
+
import {
|
|
769
|
+
Configuration,
|
|
770
|
+
DocumentApi,
|
|
771
|
+
} from '';
|
|
772
|
+
import type { GetDocumentHistoryRequest } from '';
|
|
773
|
+
|
|
774
|
+
async function example() {
|
|
775
|
+
console.log("🚀 Testing SDK...");
|
|
776
|
+
const config = new Configuration({
|
|
777
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
778
|
+
username: "YOUR USERNAME",
|
|
779
|
+
password: "YOUR PASSWORD",
|
|
780
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
781
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
782
|
+
// To configure API key authorization: apiKeyAuth
|
|
783
|
+
apiKey: "YOUR API KEY",
|
|
784
|
+
});
|
|
785
|
+
const api = new DocumentApi(config);
|
|
786
|
+
|
|
787
|
+
const body = {
|
|
788
|
+
// string | The name of your MongoDb Collection
|
|
789
|
+
collectionName: collectionName_example,
|
|
790
|
+
// string | DocumentId of the history
|
|
791
|
+
documentId: documentId_example,
|
|
792
|
+
// number (optional)
|
|
793
|
+
rowsPerPage: 789,
|
|
794
|
+
// number (optional)
|
|
795
|
+
page: 789,
|
|
796
|
+
// 'relaxed' | 'canonical' | 'plain' | relaxed (default), canonical or plain, as for the documents. (optional)
|
|
797
|
+
extendedJson: extendedJson_example,
|
|
798
|
+
} satisfies GetDocumentHistoryRequest;
|
|
799
|
+
|
|
800
|
+
try {
|
|
801
|
+
const data = await api.getDocumentHistory(body);
|
|
802
|
+
console.log(data);
|
|
803
|
+
} catch (error) {
|
|
804
|
+
console.error(error);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// Run the test
|
|
809
|
+
example().catch(console.error);
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Parameters
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
| Name | Type | Description | Notes |
|
|
816
|
+
|------------- | ------------- | ------------- | -------------|
|
|
817
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
818
|
+
| **documentId** | `string` | DocumentId of the history | [Defaults to `undefined`] |
|
|
819
|
+
| **rowsPerPage** | `number` | | [Optional] [Defaults to `undefined`] |
|
|
820
|
+
| **page** | `number` | | [Optional] [Defaults to `undefined`] |
|
|
821
|
+
| **extendedJson** | `relaxed`, `canonical`, `plain` | relaxed (default), canonical or plain, as for the documents. | [Optional] [Defaults to `undefined`] [Enum: relaxed, canonical, plain] |
|
|
822
|
+
|
|
823
|
+
### Return type
|
|
824
|
+
|
|
825
|
+
[**Array<AuditEntry>**](AuditEntry.md)
|
|
826
|
+
|
|
827
|
+
### Authorization
|
|
828
|
+
|
|
829
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
830
|
+
|
|
831
|
+
### HTTP request headers
|
|
832
|
+
|
|
833
|
+
- **Content-Type**: Not defined
|
|
834
|
+
- **Accept**: `application/json`, `text/plain`
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
### HTTP response details
|
|
838
|
+
| Status code | Description | Response headers |
|
|
839
|
+
|-------------|-------------|------------------|
|
|
840
|
+
| **200** | | - |
|
|
841
|
+
| **400** | Invalid value for: body | - |
|
|
842
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
843
|
+
|
|
844
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
845
|
+
|
|
846
|
+
|
|
555
847
|
## importDocuments
|
|
556
848
|
|
|
557
849
|
> ImportResponse importDocuments(collectionName, body)
|
|
@@ -800,7 +1092,7 @@ example().catch(console.error);
|
|
|
800
1092
|
|
|
801
1093
|
## listDocuments
|
|
802
1094
|
|
|
803
|
-
> Array<{ [key: string]: any | null; }> listDocuments(collectionName, filter, sort, projection, rowsPerPage, page, count, after, extendedJson, filterCaseInsensitive)
|
|
1095
|
+
> Array<{ [key: string]: any | null; }> listDocuments(collectionName, withDeleted, filter, sort, projection, rowsPerPage, page, count, after, extendedJson, filterCaseInsensitive)
|
|
804
1096
|
|
|
805
1097
|
Documents in Collection
|
|
806
1098
|
|
|
@@ -831,6 +1123,8 @@ async function example() {
|
|
|
831
1123
|
const body = {
|
|
832
1124
|
// string | The name of your MongoDb Collection
|
|
833
1125
|
collectionName: collectionName_example,
|
|
1126
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
1127
|
+
withDeleted: true,
|
|
834
1128
|
// string | MongoDB filter query, all documents by default (optional)
|
|
835
1129
|
filter: filter_example,
|
|
836
1130
|
// Array<string> | MongoDB sorting (optional)
|
|
@@ -869,6 +1163,7 @@ example().catch(console.error);
|
|
|
869
1163
|
| Name | Type | Description | Notes |
|
|
870
1164
|
|------------- | ------------- | ------------- | -------------|
|
|
871
1165
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1166
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
872
1167
|
| **filter** | `string` | MongoDB filter query, all documents by default | [Optional] [Defaults to `undefined`] |
|
|
873
1168
|
| **sort** | `Array<string>` | MongoDB sorting | [Optional] |
|
|
874
1169
|
| **projection** | `Array<string>` | MongoDB projection | [Optional] |
|
|
@@ -903,9 +1198,90 @@ example().catch(console.error);
|
|
|
903
1198
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
904
1199
|
|
|
905
1200
|
|
|
1201
|
+
## restoreDocument
|
|
1202
|
+
|
|
1203
|
+
> UpdateResponse restoreDocument(collectionName, documentId)
|
|
1204
|
+
|
|
1205
|
+
Restore a soft-deleted Document
|
|
1206
|
+
|
|
1207
|
+
Removes the deleted mark of a document of a collection declared with softDelete (2.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
1208
|
+
|
|
1209
|
+
### Example
|
|
1210
|
+
|
|
1211
|
+
```ts
|
|
1212
|
+
import {
|
|
1213
|
+
Configuration,
|
|
1214
|
+
DocumentApi,
|
|
1215
|
+
} from '';
|
|
1216
|
+
import type { RestoreDocumentRequest } from '';
|
|
1217
|
+
|
|
1218
|
+
async function example() {
|
|
1219
|
+
console.log("🚀 Testing SDK...");
|
|
1220
|
+
const config = new Configuration({
|
|
1221
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
1222
|
+
username: "YOUR USERNAME",
|
|
1223
|
+
password: "YOUR PASSWORD",
|
|
1224
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
1225
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
1226
|
+
// To configure API key authorization: apiKeyAuth
|
|
1227
|
+
apiKey: "YOUR API KEY",
|
|
1228
|
+
});
|
|
1229
|
+
const api = new DocumentApi(config);
|
|
1230
|
+
|
|
1231
|
+
const body = {
|
|
1232
|
+
// string | The name of your MongoDb Collection
|
|
1233
|
+
collectionName: collectionName_example,
|
|
1234
|
+
// string | DocumentId to restore
|
|
1235
|
+
documentId: documentId_example,
|
|
1236
|
+
} satisfies RestoreDocumentRequest;
|
|
1237
|
+
|
|
1238
|
+
try {
|
|
1239
|
+
const data = await api.restoreDocument(body);
|
|
1240
|
+
console.log(data);
|
|
1241
|
+
} catch (error) {
|
|
1242
|
+
console.error(error);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// Run the test
|
|
1247
|
+
example().catch(console.error);
|
|
1248
|
+
```
|
|
1249
|
+
|
|
1250
|
+
### Parameters
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
| Name | Type | Description | Notes |
|
|
1254
|
+
|------------- | ------------- | ------------- | -------------|
|
|
1255
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1256
|
+
| **documentId** | `string` | DocumentId to restore | [Defaults to `undefined`] |
|
|
1257
|
+
|
|
1258
|
+
### Return type
|
|
1259
|
+
|
|
1260
|
+
[**UpdateResponse**](UpdateResponse.md)
|
|
1261
|
+
|
|
1262
|
+
### Authorization
|
|
1263
|
+
|
|
1264
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
1265
|
+
|
|
1266
|
+
### HTTP request headers
|
|
1267
|
+
|
|
1268
|
+
- **Content-Type**: Not defined
|
|
1269
|
+
- **Accept**: `application/json`, `text/plain`
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
### HTTP response details
|
|
1273
|
+
| Status code | Description | Response headers |
|
|
1274
|
+
|-------------|-------------|------------------|
|
|
1275
|
+
| **200** | | - |
|
|
1276
|
+
| **400** | Invalid value for: body | - |
|
|
1277
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
1278
|
+
|
|
1279
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1280
|
+
|
|
1281
|
+
|
|
906
1282
|
## searchDocuments
|
|
907
1283
|
|
|
908
|
-
> Array<{ [key: string]: any | null; }> searchDocuments(collectionName, searchRequest, rowsPerPage, page, count, after, extendedJson, filterCaseInsensitive)
|
|
1284
|
+
> Array<{ [key: string]: any | null; }> searchDocuments(collectionName, searchRequest, withDeleted, rowsPerPage, page, count, after, extendedJson, filterCaseInsensitive)
|
|
909
1285
|
|
|
910
1286
|
Search Documents in Collection
|
|
911
1287
|
|
|
@@ -938,6 +1314,8 @@ async function example() {
|
|
|
938
1314
|
collectionName: collectionName_example,
|
|
939
1315
|
// SearchRequest
|
|
940
1316
|
searchRequest: {"filter":"name:John AND age:[18 TO 65]","sort":["-age"],"projection":["name","age"]},
|
|
1317
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
1318
|
+
withDeleted: true,
|
|
941
1319
|
// number | Count elements per page (optional)
|
|
942
1320
|
rowsPerPage: 100,
|
|
943
1321
|
// number | Requested page of the ResultSets (optional)
|
|
@@ -971,6 +1349,7 @@ example().catch(console.error);
|
|
|
971
1349
|
|------------- | ------------- | ------------- | -------------|
|
|
972
1350
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
973
1351
|
| **searchRequest** | [SearchRequest](SearchRequest.md) | | |
|
|
1352
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
974
1353
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
975
1354
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
976
1355
|
| **count** | `exact`, `none` | How the result is counted: exact (default) or none (no count headers, no count query) | [Optional] [Defaults to `'exact'`] [Enum: exact, none] |
|
|
@@ -1185,7 +1564,7 @@ import {
|
|
|
1185
1564
|
Configuration,
|
|
1186
1565
|
DocumentApi,
|
|
1187
1566
|
} from '';
|
|
1188
|
-
import type {
|
|
1567
|
+
import type { UpdateManyOperationRequest } from '';
|
|
1189
1568
|
|
|
1190
1569
|
async function example() {
|
|
1191
1570
|
console.log("🚀 Testing SDK...");
|
|
@@ -1203,7 +1582,7 @@ async function example() {
|
|
|
1203
1582
|
const body = {
|
|
1204
1583
|
// string | The name of your MongoDb Collection
|
|
1205
1584
|
collectionName: collectionName_example,
|
|
1206
|
-
//
|
|
1585
|
+
// UpdateManyRequest
|
|
1207
1586
|
updateRequest: ...,
|
|
1208
1587
|
// boolean | Allow an empty filter, that matches all documents of the collection (optional)
|
|
1209
1588
|
matchAll: true,
|
|
@@ -1211,7 +1590,7 @@ async function example() {
|
|
|
1211
1590
|
filter: filter_example,
|
|
1212
1591
|
// boolean | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* (optional)
|
|
1213
1592
|
filterCaseInsensitive: false,
|
|
1214
|
-
} satisfies
|
|
1593
|
+
} satisfies UpdateManyOperationRequest;
|
|
1215
1594
|
|
|
1216
1595
|
try {
|
|
1217
1596
|
const data = await api.updateMany(body);
|
|
@@ -1231,7 +1610,7 @@ example().catch(console.error);
|
|
|
1231
1610
|
| Name | Type | Description | Notes |
|
|
1232
1611
|
|------------- | ------------- | ------------- | -------------|
|
|
1233
1612
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1234
|
-
| **updateRequest** | [
|
|
1613
|
+
| **updateRequest** | [UpdateManyRequest](UpdateManyRequest.md) | | |
|
|
1235
1614
|
| **matchAll** | `boolean` | Allow an empty filter, that matches all documents of the collection | [Optional] [Defaults to `false`] |
|
|
1236
1615
|
| **filter** | `string` | Filter Query like on the list of documents, as an alternative to the filter of the request body. Use only one of both. | [Optional] [Defaults to `undefined`] |
|
|
1237
1616
|
| **filterCaseInsensitive** | `boolean` | true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc* | [Optional] [Defaults to `false`] |
|
|
@@ -1259,3 +1638,79 @@ example().catch(console.error);
|
|
|
1259
1638
|
|
|
1260
1639
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1261
1640
|
|
|
1641
|
+
|
|
1642
|
+
## watchDocuments
|
|
1643
|
+
|
|
1644
|
+
> string watchDocuments(collectionName, filter, filterCaseInsensitive, lastEventID)
|
|
1645
|
+
|
|
1646
|
+
Live Updates of a Collection
|
|
1647
|
+
|
|
1648
|
+
The changes of the documents as Server-Sent Events (2.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
|
|
1649
|
+
|
|
1650
|
+
### Example
|
|
1651
|
+
|
|
1652
|
+
```ts
|
|
1653
|
+
import {
|
|
1654
|
+
Configuration,
|
|
1655
|
+
DocumentApi,
|
|
1656
|
+
} from '';
|
|
1657
|
+
import type { WatchDocumentsRequest } from '';
|
|
1658
|
+
|
|
1659
|
+
async function example() {
|
|
1660
|
+
console.log("🚀 Testing SDK...");
|
|
1661
|
+
const api = new DocumentApi();
|
|
1662
|
+
|
|
1663
|
+
const body = {
|
|
1664
|
+
// string | The name of your MongoDb Collection
|
|
1665
|
+
collectionName: collectionName_example,
|
|
1666
|
+
// string | Lucene filter of the documents to watch. (optional)
|
|
1667
|
+
filter: filter_example,
|
|
1668
|
+
// boolean (optional)
|
|
1669
|
+
filterCaseInsensitive: true,
|
|
1670
|
+
// string | The id of the last event the client got, to resume after it. (optional)
|
|
1671
|
+
lastEventID: lastEventID_example,
|
|
1672
|
+
} satisfies WatchDocumentsRequest;
|
|
1673
|
+
|
|
1674
|
+
try {
|
|
1675
|
+
const data = await api.watchDocuments(body);
|
|
1676
|
+
console.log(data);
|
|
1677
|
+
} catch (error) {
|
|
1678
|
+
console.error(error);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
// Run the test
|
|
1683
|
+
example().catch(console.error);
|
|
1684
|
+
```
|
|
1685
|
+
|
|
1686
|
+
### Parameters
|
|
1687
|
+
|
|
1688
|
+
|
|
1689
|
+
| Name | Type | Description | Notes |
|
|
1690
|
+
|------------- | ------------- | ------------- | -------------|
|
|
1691
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1692
|
+
| **filter** | `string` | Lucene filter of the documents to watch. | [Optional] [Defaults to `undefined`] |
|
|
1693
|
+
| **filterCaseInsensitive** | `boolean` | | [Optional] [Defaults to `undefined`] |
|
|
1694
|
+
| **lastEventID** | `string` | The id of the last event the client got, to resume after it. | [Optional] [Defaults to `undefined`] |
|
|
1695
|
+
|
|
1696
|
+
### Return type
|
|
1697
|
+
|
|
1698
|
+
**string**
|
|
1699
|
+
|
|
1700
|
+
### Authorization
|
|
1701
|
+
|
|
1702
|
+
No authorization required
|
|
1703
|
+
|
|
1704
|
+
### HTTP request headers
|
|
1705
|
+
|
|
1706
|
+
- **Content-Type**: Not defined
|
|
1707
|
+
- **Accept**: `text/event-stream`
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
### HTTP response details
|
|
1711
|
+
| Status code | Description | Response headers |
|
|
1712
|
+
|-------------|-------------|------------------|
|
|
1713
|
+
| **200** | text/event-stream | - |
|
|
1714
|
+
|
|
1715
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1716
|
+
|