@sfxcode/nuxt-mongocamp-server 2.0.0 → 2.2.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 +26 -20
- package/dist/module.d.mts +6 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +15 -3
- package/dist/runtime/api/.openapi-generator/FILES +6 -2
- package/dist/runtime/api/apis/CollectionApi.d.ts +13 -0
- package/dist/runtime/api/apis/CollectionApi.js +8 -0
- package/dist/runtime/api/apis/DocumentApi.d.ts +91 -8
- package/dist/runtime/api/apis/DocumentApi.js +156 -5
- package/dist/runtime/api/docs/CollectionApi.md +4 -1
- package/dist/runtime/api/docs/CountRequest.md +34 -0
- package/dist/runtime/api/docs/DocumentApi.md +188 -7
- 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/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
- package/dist/runtime/api/models/CountRequest.d.ts +30 -0
- package/dist/runtime/api/models/CountRequest.js +25 -0
- 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/UpdateManyRequest.d.ts +38 -0
- package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
- package/dist/runtime/api/models/index.d.ts +3 -1
- package/dist/runtime/api/models/index.js +3 -1
- package/dist/runtime/server/mongocamp/core.d.ts +2 -0
- package/dist/runtime/server/mongocamp/core.js +8 -1
- package/dist/runtime/server/mongocamp/handler.js +9 -1
- package/dist/runtime/server/mongocamp/plugin.d.ts +5 -1
- package/dist/runtime/server/mongocamp/plugin.js +12 -1
- package/package.json +7 -3
- package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as runtime from "../runtime.js";
|
|
2
|
+
import {
|
|
3
|
+
CountRequestToJSON
|
|
4
|
+
} from "../models/CountRequest.js";
|
|
2
5
|
import {
|
|
3
6
|
CountResponseFromJSON
|
|
4
7
|
} from "../models/CountResponse.js";
|
|
5
8
|
import {
|
|
6
9
|
DeleteResponseFromJSON
|
|
7
10
|
} from "../models/DeleteResponse.js";
|
|
11
|
+
import {
|
|
12
|
+
ExportRequestToJSON
|
|
13
|
+
} from "../models/ExportRequest.js";
|
|
8
14
|
import {
|
|
9
15
|
ImportResponseFromJSON
|
|
10
16
|
} from "../models/ImportResponse.js";
|
|
@@ -18,8 +24,8 @@ import {
|
|
|
18
24
|
SearchRequestToJSON
|
|
19
25
|
} from "../models/SearchRequest.js";
|
|
20
26
|
import {
|
|
21
|
-
|
|
22
|
-
} from "../models/
|
|
27
|
+
UpdateManyRequestToJSON
|
|
28
|
+
} from "../models/UpdateManyRequest.js";
|
|
23
29
|
import {
|
|
24
30
|
UpdateResponseFromJSON
|
|
25
31
|
} from "../models/UpdateResponse.js";
|
|
@@ -139,6 +145,68 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
139
145
|
const response = await this.countDocumentsRaw(requestParameters, initOverrides);
|
|
140
146
|
return await response.value();
|
|
141
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Creates request options for countDocumentsByBody without sending the request
|
|
150
|
+
*/
|
|
151
|
+
async countDocumentsByBodyRequestOpts(requestParameters) {
|
|
152
|
+
if (requestParameters["collectionName"] == null) {
|
|
153
|
+
throw new runtime.RequiredError(
|
|
154
|
+
"collectionName",
|
|
155
|
+
'Required parameter "collectionName" was null or undefined when calling countDocumentsByBody().'
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
if (requestParameters["countRequest"] == null) {
|
|
159
|
+
throw new runtime.RequiredError(
|
|
160
|
+
"countRequest",
|
|
161
|
+
'Required parameter "countRequest" was null or undefined when calling countDocumentsByBody().'
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const queryParameters = {};
|
|
165
|
+
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
166
|
+
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
167
|
+
}
|
|
168
|
+
const headerParameters = {};
|
|
169
|
+
headerParameters["Content-Type"] = "application/json";
|
|
170
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
171
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
172
|
+
}
|
|
173
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
174
|
+
const token = this.configuration.accessToken;
|
|
175
|
+
const tokenString = await token("httpAuth", []);
|
|
176
|
+
if (tokenString) {
|
|
177
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
181
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
182
|
+
}
|
|
183
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/count`;
|
|
184
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
185
|
+
return {
|
|
186
|
+
path: urlPath,
|
|
187
|
+
method: "POST",
|
|
188
|
+
headers: headerParameters,
|
|
189
|
+
query: queryParameters,
|
|
190
|
+
body: CountRequestToJSON(requestParameters["countRequest"])
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
195
|
+
* Count Documents in Collection (filter in the body)
|
|
196
|
+
*/
|
|
197
|
+
async countDocumentsByBodyRaw(requestParameters, initOverrides) {
|
|
198
|
+
const requestOptions = await this.countDocumentsByBodyRequestOpts(requestParameters);
|
|
199
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
200
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CountResponseFromJSON(jsonValue));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
204
|
+
* Count Documents in Collection (filter in the body)
|
|
205
|
+
*/
|
|
206
|
+
async countDocumentsByBody(requestParameters, initOverrides) {
|
|
207
|
+
const response = await this.countDocumentsByBodyRaw(requestParameters, initOverrides);
|
|
208
|
+
return await response.value();
|
|
209
|
+
}
|
|
142
210
|
/**
|
|
143
211
|
* Creates request options for deleteMany without sending the request
|
|
144
212
|
*/
|
|
@@ -239,6 +307,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
239
307
|
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
240
308
|
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
241
309
|
}
|
|
310
|
+
if (requestParameters["trailer"] != null) {
|
|
311
|
+
queryParameters["trailer"] = requestParameters["trailer"];
|
|
312
|
+
}
|
|
242
313
|
const headerParameters = {};
|
|
243
314
|
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
244
315
|
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
@@ -263,7 +334,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
263
334
|
};
|
|
264
335
|
}
|
|
265
336
|
/**
|
|
266
|
-
* 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.
|
|
337
|
+
* 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).
|
|
267
338
|
* Export Documents of a Collection
|
|
268
339
|
*/
|
|
269
340
|
async exportDocumentsRaw(requestParameters, initOverrides) {
|
|
@@ -276,13 +347,88 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
276
347
|
}
|
|
277
348
|
}
|
|
278
349
|
/**
|
|
279
|
-
* 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.
|
|
350
|
+
* 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).
|
|
280
351
|
* Export Documents of a Collection
|
|
281
352
|
*/
|
|
282
353
|
async exportDocuments(requestParameters, initOverrides) {
|
|
283
354
|
const response = await this.exportDocumentsRaw(requestParameters, initOverrides);
|
|
284
355
|
return await response.value();
|
|
285
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Creates request options for exportDocumentsByBody without sending the request
|
|
359
|
+
*/
|
|
360
|
+
async exportDocumentsByBodyRequestOpts(requestParameters) {
|
|
361
|
+
if (requestParameters["collectionName"] == null) {
|
|
362
|
+
throw new runtime.RequiredError(
|
|
363
|
+
"collectionName",
|
|
364
|
+
'Required parameter "collectionName" was null or undefined when calling exportDocumentsByBody().'
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
if (requestParameters["exportRequest"] == null) {
|
|
368
|
+
throw new runtime.RequiredError(
|
|
369
|
+
"exportRequest",
|
|
370
|
+
'Required parameter "exportRequest" was null or undefined when calling exportDocumentsByBody().'
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
const queryParameters = {};
|
|
374
|
+
if (requestParameters["format"] != null) {
|
|
375
|
+
queryParameters["format"] = requestParameters["format"];
|
|
376
|
+
}
|
|
377
|
+
if (requestParameters["extendedJson"] != null) {
|
|
378
|
+
queryParameters["extendedJson"] = requestParameters["extendedJson"];
|
|
379
|
+
}
|
|
380
|
+
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
381
|
+
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
382
|
+
}
|
|
383
|
+
if (requestParameters["trailer"] != null) {
|
|
384
|
+
queryParameters["trailer"] = requestParameters["trailer"];
|
|
385
|
+
}
|
|
386
|
+
const headerParameters = {};
|
|
387
|
+
headerParameters["Content-Type"] = "application/json";
|
|
388
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
389
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
390
|
+
}
|
|
391
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
392
|
+
const token = this.configuration.accessToken;
|
|
393
|
+
const tokenString = await token("httpAuth", []);
|
|
394
|
+
if (tokenString) {
|
|
395
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
399
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
400
|
+
}
|
|
401
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/export`;
|
|
402
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
403
|
+
return {
|
|
404
|
+
path: urlPath,
|
|
405
|
+
method: "POST",
|
|
406
|
+
headers: headerParameters,
|
|
407
|
+
query: queryParameters,
|
|
408
|
+
body: ExportRequestToJSON(requestParameters["exportRequest"])
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* 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).
|
|
413
|
+
* Export Documents of a Collection (filter in the body)
|
|
414
|
+
*/
|
|
415
|
+
async exportDocumentsByBodyRaw(requestParameters, initOverrides) {
|
|
416
|
+
const requestOptions = await this.exportDocumentsByBodyRequestOpts(requestParameters);
|
|
417
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
418
|
+
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
419
|
+
return new runtime.JSONApiResponse(response);
|
|
420
|
+
} else {
|
|
421
|
+
return new runtime.TextApiResponse(response);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* 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).
|
|
426
|
+
* Export Documents of a Collection (filter in the body)
|
|
427
|
+
*/
|
|
428
|
+
async exportDocumentsByBody(requestParameters, initOverrides) {
|
|
429
|
+
const response = await this.exportDocumentsByBodyRaw(requestParameters, initOverrides);
|
|
430
|
+
return await response.value();
|
|
431
|
+
}
|
|
286
432
|
/**
|
|
287
433
|
* Creates request options for find without sending the request
|
|
288
434
|
*/
|
|
@@ -927,7 +1073,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
927
1073
|
method: "PATCH",
|
|
928
1074
|
headers: headerParameters,
|
|
929
1075
|
query: queryParameters,
|
|
930
|
-
body:
|
|
1076
|
+
body: UpdateManyRequestToJSON(requestParameters["updateRequest"])
|
|
931
1077
|
};
|
|
932
1078
|
}
|
|
933
1079
|
/**
|
|
@@ -953,6 +1099,11 @@ export const ExportDocumentsExtendedJsonEnum = {
|
|
|
953
1099
|
Canonical: "canonical",
|
|
954
1100
|
Plain: "plain"
|
|
955
1101
|
};
|
|
1102
|
+
export const ExportDocumentsByBodyExtendedJsonEnum = {
|
|
1103
|
+
Relaxed: "relaxed",
|
|
1104
|
+
Canonical: "canonical",
|
|
1105
|
+
Plain: "plain"
|
|
1106
|
+
};
|
|
956
1107
|
export const FindCountEnum = {
|
|
957
1108
|
Exact: "exact",
|
|
958
1109
|
None: "none"
|
|
@@ -444,7 +444,7 @@ example().catch(console.error);
|
|
|
444
444
|
|
|
445
445
|
## distinct
|
|
446
446
|
|
|
447
|
-
> Array<any> distinct(collectionName, field, rowsPerPage, page, count)
|
|
447
|
+
> Array<any> distinct(collectionName, field, rowsPerPage, page, count, extendedJson)
|
|
448
448
|
|
|
449
449
|
Distinct in Collection
|
|
450
450
|
|
|
@@ -483,6 +483,8 @@ async function example() {
|
|
|
483
483
|
page: 1,
|
|
484
484
|
// 'exact' | 'none' | How the result is counted: exact (default) or none (no count headers, no count query) (optional)
|
|
485
485
|
count: exact,
|
|
486
|
+
// 'relaxed' | 'canonical' | 'plain' | plain (default) or relaxed / canonical (2.1.0): the values as MongoDB Extended JSON, so ObjectIds, dates, decimals and integers beyond 2^53 keep their types ({\"$numberLong\": ...} instead of a bare number that JavaScript rounds) (optional)
|
|
487
|
+
extendedJson: extendedJson_example,
|
|
486
488
|
} satisfies DistinctRequest;
|
|
487
489
|
|
|
488
490
|
try {
|
|
@@ -507,6 +509,7 @@ example().catch(console.error);
|
|
|
507
509
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
508
510
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
509
511
|
| **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] |
|
|
512
|
+
| **extendedJson** | `relaxed`, `canonical`, `plain` | plain (default) or relaxed / canonical (2.1.0): the values as MongoDB Extended JSON, so ObjectIds, dates, decimals and integers beyond 2^53 keep their types ({\"$numberLong\": ...} instead of a bare number that JavaScript rounds) | [Optional] [Defaults to `'plain'`] [Enum: relaxed, canonical, plain] |
|
|
510
513
|
|
|
511
514
|
### Return type
|
|
512
515
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# CountRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`filter` | string
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { CountRequest } from ''
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"filter": null,
|
|
19
|
+
} satisfies CountRequest
|
|
20
|
+
|
|
21
|
+
console.log(example)
|
|
22
|
+
|
|
23
|
+
// Convert the instance to a JSON string
|
|
24
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
25
|
+
console.log(exampleJSON)
|
|
26
|
+
|
|
27
|
+
// Parse the JSON string back to an object
|
|
28
|
+
const exampleParsed = JSON.parse(exampleJSON) as CountRequest
|
|
29
|
+
console.log(exampleParsed)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
33
|
+
|
|
34
|
+
|
|
@@ -6,8 +6,10 @@ 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 |
|
|
13
15
|
| [**importDocuments**](DocumentApi.md#importdocuments) | **POST** /mongodb/collections/{collectionName}/documents/import | Import Documents into a Collection |
|
|
@@ -17,7 +19,7 @@ All URIs are relative to *http://localhost*
|
|
|
17
19
|
| [**searchDocuments**](DocumentApi.md#searchdocuments) | **POST** /mongodb/collections/{collectionName}/documents/search | Search Documents in Collection |
|
|
18
20
|
| [**update**](DocumentApi.md#update) | **PATCH** /mongodb/collections/{collectionName}/documents/{documentId} | Update Document in Collection |
|
|
19
21
|
| [**updateDocumentPartial**](DocumentApi.md#updatedocumentpartial) | **PATCH** /mongodb/collections/{collectionName}/documents/{documentId}/partial | Update Document Parts in Collection |
|
|
20
|
-
| [**updateMany**](DocumentApi.md#
|
|
22
|
+
| [**updateMany**](DocumentApi.md#updatemanyoperation) | **PATCH** /mongodb/collections/{collectionName}/documents/many/update | Update many in Collection |
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
|
|
@@ -184,6 +186,89 @@ example().catch(console.error);
|
|
|
184
186
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
185
187
|
|
|
186
188
|
|
|
189
|
+
## countDocumentsByBody
|
|
190
|
+
|
|
191
|
+
> CountResponse countDocumentsByBody(collectionName, countRequest, filterCaseInsensitive)
|
|
192
|
+
|
|
193
|
+
Count Documents in Collection (filter in the body)
|
|
194
|
+
|
|
195
|
+
Count the Documents of the given Collection that match the filter without loading them
|
|
196
|
+
|
|
197
|
+
### Example
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import {
|
|
201
|
+
Configuration,
|
|
202
|
+
DocumentApi,
|
|
203
|
+
} from '';
|
|
204
|
+
import type { CountDocumentsByBodyRequest } from '';
|
|
205
|
+
|
|
206
|
+
async function example() {
|
|
207
|
+
console.log("🚀 Testing SDK...");
|
|
208
|
+
const config = new Configuration({
|
|
209
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
210
|
+
username: "YOUR USERNAME",
|
|
211
|
+
password: "YOUR PASSWORD",
|
|
212
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
213
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
214
|
+
// To configure API key authorization: apiKeyAuth
|
|
215
|
+
apiKey: "YOUR API KEY",
|
|
216
|
+
});
|
|
217
|
+
const api = new DocumentApi(config);
|
|
218
|
+
|
|
219
|
+
const body = {
|
|
220
|
+
// string | The name of your MongoDb Collection
|
|
221
|
+
collectionName: collectionName_example,
|
|
222
|
+
// CountRequest
|
|
223
|
+
countRequest: {"filter":"country:DE"},
|
|
224
|
+
// 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)
|
|
225
|
+
filterCaseInsensitive: false,
|
|
226
|
+
} satisfies CountDocumentsByBodyRequest;
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
const data = await api.countDocumentsByBody(body);
|
|
230
|
+
console.log(data);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error(error);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Run the test
|
|
237
|
+
example().catch(console.error);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Parameters
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
| Name | Type | Description | Notes |
|
|
244
|
+
|------------- | ------------- | ------------- | -------------|
|
|
245
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
246
|
+
| **countRequest** | [CountRequest](CountRequest.md) | | |
|
|
247
|
+
| **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`] |
|
|
248
|
+
|
|
249
|
+
### Return type
|
|
250
|
+
|
|
251
|
+
[**CountResponse**](CountResponse.md)
|
|
252
|
+
|
|
253
|
+
### Authorization
|
|
254
|
+
|
|
255
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
256
|
+
|
|
257
|
+
### HTTP request headers
|
|
258
|
+
|
|
259
|
+
- **Content-Type**: `application/json`
|
|
260
|
+
- **Accept**: `application/json`
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
### HTTP response details
|
|
264
|
+
| Status code | Description | Response headers |
|
|
265
|
+
|-------------|-------------|------------------|
|
|
266
|
+
| **200** | | - |
|
|
267
|
+
| **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> |
|
|
268
|
+
|
|
269
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
270
|
+
|
|
271
|
+
|
|
187
272
|
## deleteMany
|
|
188
273
|
|
|
189
274
|
> DeleteResponse deleteMany(collectionName, requestBody, matchAll, filter, filterCaseInsensitive)
|
|
@@ -276,11 +361,11 @@ example().catch(console.error);
|
|
|
276
361
|
|
|
277
362
|
## exportDocuments
|
|
278
363
|
|
|
279
|
-
> string exportDocuments(collectionName, format, filter, sort, projection, limit, extendedJson, filterCaseInsensitive)
|
|
364
|
+
> string exportDocuments(collectionName, format, filter, sort, projection, limit, extendedJson, filterCaseInsensitive, trailer)
|
|
280
365
|
|
|
281
366
|
Export Documents of a Collection
|
|
282
367
|
|
|
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.
|
|
368
|
+
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
369
|
|
|
285
370
|
### Example
|
|
286
371
|
|
|
@@ -321,6 +406,8 @@ async function example() {
|
|
|
321
406
|
extendedJson: extendedJson_example,
|
|
322
407
|
// 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
408
|
filterCaseInsensitive: false,
|
|
409
|
+
// 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)
|
|
410
|
+
trailer: false,
|
|
324
411
|
} satisfies ExportDocumentsRequest;
|
|
325
412
|
|
|
326
413
|
try {
|
|
@@ -348,6 +435,7 @@ example().catch(console.error);
|
|
|
348
435
|
| **limit** | `number` | The greatest number of documents, by default all | [Optional] [Defaults to `undefined`] |
|
|
349
436
|
| **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
437
|
| **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`] |
|
|
438
|
+
| **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
439
|
|
|
352
440
|
### Return type
|
|
353
441
|
|
|
@@ -373,6 +461,99 @@ example().catch(console.error);
|
|
|
373
461
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
374
462
|
|
|
375
463
|
|
|
464
|
+
## exportDocumentsByBody
|
|
465
|
+
|
|
466
|
+
> string exportDocumentsByBody(collectionName, exportRequest, format, extendedJson, filterCaseInsensitive, trailer)
|
|
467
|
+
|
|
468
|
+
Export Documents of a Collection (filter in the body)
|
|
469
|
+
|
|
470
|
+
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).
|
|
471
|
+
|
|
472
|
+
### Example
|
|
473
|
+
|
|
474
|
+
```ts
|
|
475
|
+
import {
|
|
476
|
+
Configuration,
|
|
477
|
+
DocumentApi,
|
|
478
|
+
} from '';
|
|
479
|
+
import type { ExportDocumentsByBodyRequest } from '';
|
|
480
|
+
|
|
481
|
+
async function example() {
|
|
482
|
+
console.log("🚀 Testing SDK...");
|
|
483
|
+
const config = new Configuration({
|
|
484
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
485
|
+
username: "YOUR USERNAME",
|
|
486
|
+
password: "YOUR PASSWORD",
|
|
487
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
488
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
489
|
+
// To configure API key authorization: apiKeyAuth
|
|
490
|
+
apiKey: "YOUR API KEY",
|
|
491
|
+
});
|
|
492
|
+
const api = new DocumentApi(config);
|
|
493
|
+
|
|
494
|
+
const body = {
|
|
495
|
+
// string | The name of your MongoDb Collection
|
|
496
|
+
collectionName: collectionName_example,
|
|
497
|
+
// ExportRequest
|
|
498
|
+
exportRequest: {"filter":"country:DE AND age:[18 TO 65]","sort":["-age"],"projection":["name","age"]},
|
|
499
|
+
// string | ndjson (one JSON document per line), json (one array) or csv (optional)
|
|
500
|
+
format: format_example,
|
|
501
|
+
// '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)
|
|
502
|
+
extendedJson: extendedJson_example,
|
|
503
|
+
// 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)
|
|
504
|
+
filterCaseInsensitive: false,
|
|
505
|
+
// 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)
|
|
506
|
+
trailer: false,
|
|
507
|
+
} satisfies ExportDocumentsByBodyRequest;
|
|
508
|
+
|
|
509
|
+
try {
|
|
510
|
+
const data = await api.exportDocumentsByBody(body);
|
|
511
|
+
console.log(data);
|
|
512
|
+
} catch (error) {
|
|
513
|
+
console.error(error);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// Run the test
|
|
518
|
+
example().catch(console.error);
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Parameters
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
| Name | Type | Description | Notes |
|
|
525
|
+
|------------- | ------------- | ------------- | -------------|
|
|
526
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
527
|
+
| **exportRequest** | [ExportRequest](ExportRequest.md) | | |
|
|
528
|
+
| **format** | `string` | ndjson (one JSON document per line), json (one array) or csv | [Optional] [Defaults to `'ndjson'`] |
|
|
529
|
+
| **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] |
|
|
530
|
+
| **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`] |
|
|
531
|
+
| **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`] |
|
|
532
|
+
|
|
533
|
+
### Return type
|
|
534
|
+
|
|
535
|
+
**string**
|
|
536
|
+
|
|
537
|
+
### Authorization
|
|
538
|
+
|
|
539
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
540
|
+
|
|
541
|
+
### HTTP request headers
|
|
542
|
+
|
|
543
|
+
- **Content-Type**: `application/json`
|
|
544
|
+
- **Accept**: `text/plain`, `application/json`
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
### HTTP response details
|
|
548
|
+
| Status code | Description | Response headers |
|
|
549
|
+
|-------------|-------------|------------------|
|
|
550
|
+
| **200** | | * Content-Disposition - <br> |
|
|
551
|
+
| **400** | Invalid value for: query parameter limit | - |
|
|
552
|
+
| **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> |
|
|
553
|
+
|
|
554
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
555
|
+
|
|
556
|
+
|
|
376
557
|
## find
|
|
377
558
|
|
|
378
559
|
> Array<{ [key: string]: any | null; }> find(collectionName, mongoFindRequest, rowsPerPage, page, count, after, extendedJson)
|
|
@@ -1185,7 +1366,7 @@ import {
|
|
|
1185
1366
|
Configuration,
|
|
1186
1367
|
DocumentApi,
|
|
1187
1368
|
} from '';
|
|
1188
|
-
import type {
|
|
1369
|
+
import type { UpdateManyOperationRequest } from '';
|
|
1189
1370
|
|
|
1190
1371
|
async function example() {
|
|
1191
1372
|
console.log("🚀 Testing SDK...");
|
|
@@ -1203,7 +1384,7 @@ async function example() {
|
|
|
1203
1384
|
const body = {
|
|
1204
1385
|
// string | The name of your MongoDb Collection
|
|
1205
1386
|
collectionName: collectionName_example,
|
|
1206
|
-
//
|
|
1387
|
+
// UpdateManyRequest
|
|
1207
1388
|
updateRequest: ...,
|
|
1208
1389
|
// boolean | Allow an empty filter, that matches all documents of the collection (optional)
|
|
1209
1390
|
matchAll: true,
|
|
@@ -1211,7 +1392,7 @@ async function example() {
|
|
|
1211
1392
|
filter: filter_example,
|
|
1212
1393
|
// 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
1394
|
filterCaseInsensitive: false,
|
|
1214
|
-
} satisfies
|
|
1395
|
+
} satisfies UpdateManyOperationRequest;
|
|
1215
1396
|
|
|
1216
1397
|
try {
|
|
1217
1398
|
const data = await api.updateMany(body);
|
|
@@ -1231,7 +1412,7 @@ example().catch(console.error);
|
|
|
1231
1412
|
| Name | Type | Description | Notes |
|
|
1232
1413
|
|------------- | ------------- | ------------- | -------------|
|
|
1233
1414
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1234
|
-
| **updateRequest** | [
|
|
1415
|
+
| **updateRequest** | [UpdateManyRequest](UpdateManyRequest.md) | | |
|
|
1235
1416
|
| **matchAll** | `boolean` | Allow an empty filter, that matches all documents of the collection | [Optional] [Defaults to `false`] |
|
|
1236
1417
|
| **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
1418
|
| **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`] |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# ExportRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`filter` | string
|
|
10
|
+
`sort` | Array<string>
|
|
11
|
+
`projection` | Array<string>
|
|
12
|
+
`limit` | number
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { ExportRequest } from ''
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"filter": null,
|
|
22
|
+
"sort": null,
|
|
23
|
+
"projection": null,
|
|
24
|
+
"limit": null,
|
|
25
|
+
} satisfies ExportRequest
|
|
26
|
+
|
|
27
|
+
console.log(example)
|
|
28
|
+
|
|
29
|
+
// Convert the instance to a JSON string
|
|
30
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
31
|
+
console.log(exampleJSON)
|
|
32
|
+
|
|
33
|
+
// Parse the JSON string back to an object
|
|
34
|
+
const exampleParsed = JSON.parse(exampleJSON) as ExportRequest
|
|
35
|
+
console.log(exampleParsed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
39
|
+
|
|
40
|
+
|
|
@@ -8,6 +8,7 @@ Name | Type
|
|
|
8
8
|
------------ | -------------
|
|
9
9
|
`pipeline` | [Array<PipelineStage>](PipelineStage.md)
|
|
10
10
|
`allowDiskUse` | boolean
|
|
11
|
+
`filter` | string
|
|
11
12
|
|
|
12
13
|
## Example
|
|
13
14
|
|
|
@@ -18,6 +19,7 @@ import type { MongoAggregateRequest } from ''
|
|
|
18
19
|
const example = {
|
|
19
20
|
"pipeline": null,
|
|
20
21
|
"allowDiskUse": null,
|
|
22
|
+
"filter": null,
|
|
21
23
|
} satisfies MongoAggregateRequest
|
|
22
24
|
|
|
23
25
|
console.log(example)
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
Name | Type
|
|
8
8
|
------------ | -------------
|
|
9
|
-
`routesPlugins` | Array<string>
|
|
10
|
-
`filePlugins` | Array<string>
|
|
11
|
-
`ignoredPlugins` | Array<string>
|
|
12
9
|
`configurations` | { [key: string]: any | null; }
|
|
13
10
|
|
|
14
11
|
## Example
|
|
@@ -18,9 +15,6 @@ import type { SettingsResponse } from ''
|
|
|
18
15
|
|
|
19
16
|
// TODO: Update the object below with actual values
|
|
20
17
|
const example = {
|
|
21
|
-
"routesPlugins": null,
|
|
22
|
-
"filePlugins": null,
|
|
23
|
-
"ignoredPlugins": null,
|
|
24
18
|
"configurations": null,
|
|
25
19
|
} satisfies SettingsResponse
|
|
26
20
|
|