@adobe/aio-cli-plugin-app-storage 1.1.0 → 1.2.0-pre.2025-11-18.sha-9c4079ac
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 +665 -1
- package/package.json +33 -6
- package/src/BaseCommand.js +11 -58
- package/src/DBBaseCommand.js +112 -0
- package/src/StateBaseCommand.js +87 -0
- package/src/commands/app/add/db.js +20 -0
- package/src/commands/app/db/collection/create.js +119 -0
- package/src/commands/app/db/collection/drop.js +90 -0
- package/src/commands/app/db/collection/list.js +100 -0
- package/src/commands/app/db/collection/rename.js +98 -0
- package/src/commands/app/db/collection/stats.js +94 -0
- package/src/commands/app/db/delete.js +89 -0
- package/src/commands/app/db/document/count.js +96 -0
- package/src/commands/app/db/document/delete.js +95 -0
- package/src/commands/app/db/document/find.js +133 -0
- package/src/commands/app/db/document/insert.js +147 -0
- package/src/commands/app/db/document/replace.js +122 -0
- package/src/commands/app/db/document/update.js +144 -0
- package/src/commands/app/db/index/create.js +170 -0
- package/src/commands/app/db/index/drop.js +87 -0
- package/src/commands/app/db/index/list.js +82 -0
- package/src/commands/app/db/ping.js +77 -0
- package/src/commands/app/db/provision.js +190 -0
- package/src/commands/app/db/stats.js +87 -0
- package/src/commands/app/db/status.js +159 -0
- package/src/commands/app/state/delete.js +3 -3
- package/src/commands/app/state/get.js +2 -2
- package/src/commands/app/state/list.js +3 -3
- package/src/commands/app/state/put.js +4 -4
- package/src/commands/app/state/stats.js +2 -2
- package/src/constants/db.js +32 -0
- package/src/constants/global.js +14 -0
- package/src/{constants.js → constants/state.js} +3 -0
- package/src/utils/inputValidation.js +74 -0
- package/src/utils/output.js +35 -0
- package/oclif.manifest.json +0 -311
package/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# aio-cli-plugin-app-storage
|
|
2
2
|
|
|
3
|
-
The CLI Plugin to manage your App Builder State storage.
|
|
3
|
+
The CLI Plugin to manage your App Builder State storage and Database services.
|
|
4
4
|
|
|
5
5
|
If you need to access State programmatically, check the
|
|
6
6
|
[@adobe/aio-lib-state](https://github.com/adobe/aio-lib-state) library.
|
|
7
7
|
|
|
8
|
+
If you need to access Database programmatically, check the
|
|
9
|
+
[@adobe/aio-lib-db](https://github.com/adobe/aio-lib-db) library.
|
|
10
|
+
|
|
8
11
|
---
|
|
9
12
|
<!-- toc -->
|
|
10
13
|
* [aio-cli-plugin-app-storage](#aio-cli-plugin-app-storage)
|
|
@@ -19,17 +22,52 @@ $ aio plugins:install @adobe/aio-cli-plugin-app-storage
|
|
|
19
22
|
$ # OR
|
|
20
23
|
$ aio discover -i
|
|
21
24
|
$ aio app state --help
|
|
25
|
+
$ aio app db --help
|
|
22
26
|
```
|
|
23
27
|
|
|
24
28
|
# Commands
|
|
25
29
|
<!-- commands -->
|
|
30
|
+
## State Storage Commands
|
|
26
31
|
* [`aio app state delete [KEYS]`](#aio-app-state-delete-keys)
|
|
27
32
|
* [`aio app state get KEY`](#aio-app-state-get-key)
|
|
28
33
|
* [`aio app state list`](#aio-app-state-list)
|
|
29
34
|
* [`aio app state put KEY VALUE`](#aio-app-state-put-key-value)
|
|
30
35
|
* [`aio app state stats`](#aio-app-state-stats)
|
|
36
|
+
|
|
37
|
+
## Database Commands
|
|
38
|
+
### Collection Management
|
|
39
|
+
* [`aio app db collection list`](#aio-app-db-collection-list)
|
|
40
|
+
* [`aio app db collection create COLLECTION`](#aio-app-db-collection-create-collection)
|
|
41
|
+
* [`aio app db collection drop COLLECTION`](#aio-app-db-collection-drop-collection)
|
|
42
|
+
* [`aio app db collection rename CURRENTNAME NEWNAME`](#aio-app-db-collection-rename-currentname-newname)
|
|
43
|
+
* [`aio app db collection stats COLLECTION`](#aio-app-db-collection-stats-collection)
|
|
44
|
+
|
|
45
|
+
### Document Operations
|
|
46
|
+
* [`aio app db document insert COLLECTION DOCUMENTS`](#aio-app-db-document-insert-collection-documents)
|
|
47
|
+
* [`aio app db document delete COLLECTION FILTER`](#aio-app-db-document-delete-collection-filter)
|
|
48
|
+
* [`aio app db document find COLLECTION FILTER`](#aio-app-db-document-find-collection-filter)
|
|
49
|
+
* [`aio app db document update COLLECTION FILTER UPDATE`](#aio-app-db-document-update-collection-filter-update)
|
|
50
|
+
* [`aio app db document replace COLLECTION FILTER REPLACEMENT`](#aio-app-db-document-replace-collection-filter-replacement)
|
|
51
|
+
* [`aio app db document count COLLECTION`](#aio-app-db-document-count-collection)
|
|
52
|
+
|
|
53
|
+
### Index Management
|
|
54
|
+
* [`aio app db index create COLLECTION`](#aio-app-db-index-create-collection)
|
|
55
|
+
* [`aio app db index drop COLLECTION INDEXNAME`](#aio-app-db-index-drop-collection-indexname)
|
|
56
|
+
* [`aio app db index list COLLECTION`](#aio-app-db-index-list-collection)
|
|
57
|
+
|
|
58
|
+
### Database Management
|
|
59
|
+
* [`aio app db ping`](#aio-app-db-ping)
|
|
60
|
+
* [`aio app db provision`](#aio-app-db-provision)
|
|
61
|
+
* [`aio app db delete`](#aio-app-db-delete)
|
|
62
|
+
* [`aio app db status`](#aio-app-db-status)
|
|
63
|
+
* [`aio app db stats`](#aio-app-db-stats)
|
|
64
|
+
* `aio app db show collections` - Alias for [`aio app db collection list`](#aio-app-db-collection-list)
|
|
65
|
+
|
|
66
|
+
## Other Commands
|
|
31
67
|
* [`aio help [COMMAND]`](#aio-help-command)
|
|
32
68
|
|
|
69
|
+
# State Storage Commands
|
|
70
|
+
|
|
33
71
|
## `aio app state delete [KEYS]`
|
|
34
72
|
|
|
35
73
|
Delete key-values
|
|
@@ -190,6 +228,632 @@ EXAMPLES
|
|
|
190
228
|
$ aio app state stats --json
|
|
191
229
|
```
|
|
192
230
|
|
|
231
|
+
# Database Commands
|
|
232
|
+
|
|
233
|
+
## Collection Management
|
|
234
|
+
|
|
235
|
+
> Note: The commands under `aio app db collection <command>` are also available as `aio app db col <command>` shorthand aliases.
|
|
236
|
+
|
|
237
|
+
### `aio app db collection list`
|
|
238
|
+
|
|
239
|
+
Get the list of collections in your App Builder database
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
USAGE
|
|
243
|
+
$ aio app db collection list [--json] [--region <value>] [-i]
|
|
244
|
+
|
|
245
|
+
FLAGS
|
|
246
|
+
-i, --info Show detailed collection information instead of just names
|
|
247
|
+
|
|
248
|
+
GLOBAL FLAGS
|
|
249
|
+
--json Format output as json.
|
|
250
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
251
|
+
<options: amer|emea|apac>
|
|
252
|
+
|
|
253
|
+
DESCRIPTION
|
|
254
|
+
Get the list of collections in your App Builder database
|
|
255
|
+
|
|
256
|
+
ALIASES
|
|
257
|
+
$ aio app db col list
|
|
258
|
+
$ aio app db show collections
|
|
259
|
+
|
|
260
|
+
EXAMPLES
|
|
261
|
+
$ aio app db collection list
|
|
262
|
+
|
|
263
|
+
$ aio app db collection list --info
|
|
264
|
+
|
|
265
|
+
$ aio app db collection list --json
|
|
266
|
+
|
|
267
|
+
$ aio app db col list --info --json
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### `aio app db collection create COLLECTION`
|
|
271
|
+
|
|
272
|
+
Create a new collection in the database
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
USAGE
|
|
276
|
+
$ aio app db collection create COLLECTION [--json] [--region <value>] [-v <value>]
|
|
277
|
+
|
|
278
|
+
ARGUMENTS
|
|
279
|
+
COLLECTION The name of the collection to create
|
|
280
|
+
|
|
281
|
+
FLAGS
|
|
282
|
+
-v, --validator=<value> JSON schema validator for document validation (JSON string)
|
|
283
|
+
|
|
284
|
+
GLOBAL FLAGS
|
|
285
|
+
--json Format output as json.
|
|
286
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
287
|
+
<options: amer|emea|apac>
|
|
288
|
+
|
|
289
|
+
DESCRIPTION
|
|
290
|
+
Create a new collection in the database
|
|
291
|
+
|
|
292
|
+
ALIASES
|
|
293
|
+
$ aio app db col create
|
|
294
|
+
|
|
295
|
+
EXAMPLES
|
|
296
|
+
$ aio app db collection create users
|
|
297
|
+
|
|
298
|
+
$ aio app db collection create inventory --validator '{"type": "object", "required": ["id", "quantity"]}' --json
|
|
299
|
+
|
|
300
|
+
$ aio app db col create products --json
|
|
301
|
+
|
|
302
|
+
$ aio app db col create products --validator '{"type": "object", "properties": {"name": {"type": "string"}, "price": {"type": "number", "minimum": 0}}, "required": ["name", "price"]}'
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### `aio app db collection drop COLLECTION`
|
|
306
|
+
|
|
307
|
+
Drop a collection from the database
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
USAGE
|
|
311
|
+
$ aio app db collection drop COLLECTION [--json] [--region <value>]
|
|
312
|
+
|
|
313
|
+
ARGUMENTS
|
|
314
|
+
COLLECTION The name of the collection to drop
|
|
315
|
+
|
|
316
|
+
GLOBAL FLAGS
|
|
317
|
+
--json Format output as json.
|
|
318
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
319
|
+
<options: amer|emea|apac>
|
|
320
|
+
|
|
321
|
+
DESCRIPTION
|
|
322
|
+
Drop a collection from the database
|
|
323
|
+
|
|
324
|
+
ALIASES
|
|
325
|
+
$ aio app db col drop
|
|
326
|
+
|
|
327
|
+
EXAMPLES
|
|
328
|
+
$ aio app db collection drop users
|
|
329
|
+
|
|
330
|
+
$ aio app db collection drop products --json
|
|
331
|
+
|
|
332
|
+
$ aio app db col drop inventory
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### `aio app db collection rename CURRENTNAME NEWNAME`
|
|
336
|
+
|
|
337
|
+
Rename a collection in the database
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
USAGE
|
|
341
|
+
$ aio app db collection rename CURRENTNAME NEWNAME [--json] [--region <value>]
|
|
342
|
+
|
|
343
|
+
ARGUMENTS
|
|
344
|
+
CURRENTNAME The current name of the collection to rename
|
|
345
|
+
NEWNAME The new name for the collection
|
|
346
|
+
|
|
347
|
+
GLOBAL FLAGS
|
|
348
|
+
--json Format output as json.
|
|
349
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
350
|
+
<options: amer|emea|apac>
|
|
351
|
+
|
|
352
|
+
DESCRIPTION
|
|
353
|
+
Rename a collection in the database
|
|
354
|
+
|
|
355
|
+
ALIASES
|
|
356
|
+
$ aio app db col rename
|
|
357
|
+
|
|
358
|
+
EXAMPLES
|
|
359
|
+
$ aio app db collection rename users customers
|
|
360
|
+
|
|
361
|
+
$ aio app db collection rename old_products new_products --json
|
|
362
|
+
|
|
363
|
+
$ aio app db col rename inventory stock
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### `aio app db collection stats COLLECTION`
|
|
367
|
+
|
|
368
|
+
Get statistics for a collection in the database
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
USAGE
|
|
372
|
+
$ aio app db collection stats COLLECTION [--json] [--region <value>]
|
|
373
|
+
|
|
374
|
+
ARGUMENTS
|
|
375
|
+
COLLECTION The name of the collection to get stats for
|
|
376
|
+
|
|
377
|
+
GLOBAL FLAGS
|
|
378
|
+
--json Format output as json.
|
|
379
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
380
|
+
<options: amer|emea|apac>
|
|
381
|
+
|
|
382
|
+
DESCRIPTION
|
|
383
|
+
Get statistics for a collection in the database
|
|
384
|
+
|
|
385
|
+
ALIASES
|
|
386
|
+
$ aio app db col stats
|
|
387
|
+
|
|
388
|
+
EXAMPLES
|
|
389
|
+
$ aio app db collection stats users
|
|
390
|
+
|
|
391
|
+
$ aio app db collection stats products --json
|
|
392
|
+
|
|
393
|
+
$ aio app db col stats inventory
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Document Operations
|
|
397
|
+
|
|
398
|
+
> Note: The commands under `aio app db document <command>` are also available as `aio app db doc <command>` shorthand aliases.
|
|
399
|
+
|
|
400
|
+
### `aio app db document insert COLLECTION DOCUMENTS`
|
|
401
|
+
|
|
402
|
+
Insert one or more documents into a collection
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
USAGE
|
|
406
|
+
$ aio app db document insert COLLECTION DOCUMENTS [--json] [--region <value>] [-b]
|
|
407
|
+
|
|
408
|
+
ARGUMENTS
|
|
409
|
+
COLLECTION The name of the collection to insert documents into
|
|
410
|
+
DOCUMENTS JSON object or array of documents to insert
|
|
411
|
+
|
|
412
|
+
FLAGS
|
|
413
|
+
-b, --bypassDocumentValidation Bypass schema validation if present
|
|
414
|
+
|
|
415
|
+
GLOBAL FLAGS
|
|
416
|
+
--json Format output as json.
|
|
417
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
418
|
+
<options: amer|emea|apac>
|
|
419
|
+
|
|
420
|
+
DESCRIPTION
|
|
421
|
+
Insert one or more documents into a collection
|
|
422
|
+
|
|
423
|
+
ALIASES
|
|
424
|
+
$ aio app db doc insert
|
|
425
|
+
|
|
426
|
+
EXAMPLES
|
|
427
|
+
$ aio app db document insert users '{"name": "John", "age": 30}'
|
|
428
|
+
|
|
429
|
+
$ aio app db document insert products '[{"id": 1, "name": "Product A"}, {"id": 2, "name": "Product B"}]' --json
|
|
430
|
+
|
|
431
|
+
$ aio app db document insert temp '{"data": "test"}' --bypassDocumentValidation
|
|
432
|
+
|
|
433
|
+
$ aio app db doc insert bulk '[{"field": "foo"}, {"field": "bar"}]' --bypassDocumentValidation --json
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### `aio app db document delete COLLECTION FILTER`
|
|
437
|
+
|
|
438
|
+
Delete a single document from a collection
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
USAGE
|
|
442
|
+
$ aio app db document delete COLLECTION FILTER [--json] [--region <value>]
|
|
443
|
+
|
|
444
|
+
ARGUMENTS
|
|
445
|
+
COLLECTION The name of the collection
|
|
446
|
+
FILTER The filter document (JSON string)
|
|
447
|
+
|
|
448
|
+
GLOBAL FLAGS
|
|
449
|
+
--json Format output as json.
|
|
450
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
451
|
+
<options: amer|emea|apac>
|
|
452
|
+
|
|
453
|
+
DESCRIPTION
|
|
454
|
+
Delete a single document from a collection
|
|
455
|
+
|
|
456
|
+
ALIASES
|
|
457
|
+
$ aio app db doc delete
|
|
458
|
+
|
|
459
|
+
EXAMPLES
|
|
460
|
+
$ aio app db document delete users '{"name": "John"}'
|
|
461
|
+
|
|
462
|
+
$ aio app db document delete products '{"id": "123"}' --json
|
|
463
|
+
|
|
464
|
+
$ aio app db doc delete posts '{"status": "draft"}'
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### `aio app db document find COLLECTION FILTER`
|
|
468
|
+
|
|
469
|
+
Find documents in a collection based on filter criteria.
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
USAGE
|
|
473
|
+
$ aio app db document find COLLECTION FILTER [--json] [--region <value>] [-l <value>] [-s <value>] [-o <value>] [-p <value>]
|
|
474
|
+
|
|
475
|
+
ARGUMENTS
|
|
476
|
+
COLLECTION The name of the collection
|
|
477
|
+
FILTER Filter criteria for the documents to find (JSON string, e.g. '{"status": "active"}')
|
|
478
|
+
|
|
479
|
+
FLAGS
|
|
480
|
+
-l, --limit=<value> [default: 20] Limit the number of documents returned, max: 100
|
|
481
|
+
-o, --sort=<value> Sort specification as a JSON object (e.g. '{"field": 1}')
|
|
482
|
+
-p, --projection=<value> Projection specification as a JSON object (e.g. '{"field1": 1, "field2": 0}')
|
|
483
|
+
-s, --skip=<value> Skip the first N documents
|
|
484
|
+
|
|
485
|
+
GLOBAL FLAGS
|
|
486
|
+
--json Format output as json.
|
|
487
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
488
|
+
<options: amer|emea|apac>
|
|
489
|
+
|
|
490
|
+
DESCRIPTION
|
|
491
|
+
Find documents in a collection based on filter criteria.
|
|
492
|
+
|
|
493
|
+
ALIASES
|
|
494
|
+
$ aio app db doc find
|
|
495
|
+
|
|
496
|
+
EXAMPLES
|
|
497
|
+
$ aio app db document find users '{}'
|
|
498
|
+
|
|
499
|
+
$ aio app db document find products '{"category": "Computer Accessories"}' --json
|
|
500
|
+
|
|
501
|
+
$ aio app db document find products '{"name": {"$regex": "Speakers$"}}' --sort '{"price": -1}' --limit 10 --skip 5 --projection '{"name": 1, "price": 1}'
|
|
502
|
+
|
|
503
|
+
$ aio app db doc find orders '{"status": "pending"}' --sort '{"orderDate": -1}'
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### `aio app db document update COLLECTION FILTER UPDATE`
|
|
507
|
+
|
|
508
|
+
Update document(s) in a collection
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
USAGE
|
|
512
|
+
$ aio app db document update COLLECTION FILTER UPDATE [--json] [--region <value>] [-u] [-m]
|
|
513
|
+
|
|
514
|
+
ARGUMENTS
|
|
515
|
+
COLLECTION The name of the collection
|
|
516
|
+
FILTER The filter document (JSON string)
|
|
517
|
+
UPDATE The update document (JSON string)
|
|
518
|
+
|
|
519
|
+
FLAGS
|
|
520
|
+
-m, --many Update all documents matching the filter. Without this option, only the first matching document is updated.
|
|
521
|
+
-u, --upsert If no document is found, create a new one
|
|
522
|
+
|
|
523
|
+
GLOBAL FLAGS
|
|
524
|
+
--json Format output as json.
|
|
525
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
526
|
+
<options: amer|emea|apac>
|
|
527
|
+
|
|
528
|
+
DESCRIPTION
|
|
529
|
+
Update document(s) in a collection
|
|
530
|
+
|
|
531
|
+
ALIASES
|
|
532
|
+
$ aio app db doc update
|
|
533
|
+
|
|
534
|
+
EXAMPLES
|
|
535
|
+
$ aio app db document update users '{"name": "John"}' '{"$set": {"age": 31}}'
|
|
536
|
+
|
|
537
|
+
$ aio app db document update products '{"id": "123"}' '{"$inc": {"stock": -1}}' --json
|
|
538
|
+
|
|
539
|
+
$ aio app db document update posts '{"slug": "hello-world"}' '{"$set": {"status": "published"}}' --many
|
|
540
|
+
|
|
541
|
+
$ aio app db doc update users '{"email": "john@example.com"}' '{"$set": {"lastLogin": "2024-01-01"}}' --upsert
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### `aio app db document replace COLLECTION FILTER REPLACEMENT`
|
|
545
|
+
|
|
546
|
+
Replace a single document in a collection
|
|
547
|
+
|
|
548
|
+
```
|
|
549
|
+
USAGE
|
|
550
|
+
$ aio app db document replace COLLECTION FILTER REPLACEMENT [--json] [--region <value>] [-u]
|
|
551
|
+
|
|
552
|
+
ARGUMENTS
|
|
553
|
+
COLLECTION The name of the collection
|
|
554
|
+
FILTER The filter document (JSON string)
|
|
555
|
+
REPLACEMENT The replacement document (JSON string)
|
|
556
|
+
|
|
557
|
+
FLAGS
|
|
558
|
+
-u, --upsert If no document is found, create a new one
|
|
559
|
+
|
|
560
|
+
GLOBAL FLAGS
|
|
561
|
+
--json Format output as json.
|
|
562
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
563
|
+
<options: amer|emea|apac>
|
|
564
|
+
|
|
565
|
+
DESCRIPTION
|
|
566
|
+
Replace a single document in a collection
|
|
567
|
+
|
|
568
|
+
ALIASES
|
|
569
|
+
$ aio app db doc replace
|
|
570
|
+
|
|
571
|
+
EXAMPLES
|
|
572
|
+
$ aio app db document replace users '{"name": "John"}' '{"name": "John Doe", "age": 30, "status": "active"}'
|
|
573
|
+
|
|
574
|
+
$ aio app db document replace products '{"id": "123"}' '{"id": "123", "name": "New Product", "price": 99.99}' --json
|
|
575
|
+
|
|
576
|
+
$ aio app db document replace posts '{"slug": "hello-world"}' '{"title": "Hello World", "content": "Updated content", "status": "published"}' --upsert
|
|
577
|
+
|
|
578
|
+
$ aio app db doc replace users '{"email": "john@example.com"}' '{"email": "john@example.com", "name": "John", "verified": true}' --upsert --json
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
### `aio app db document count COLLECTION`
|
|
582
|
+
|
|
583
|
+
Count documents in a collection
|
|
584
|
+
|
|
585
|
+
```
|
|
586
|
+
USAGE
|
|
587
|
+
$ aio app db document count COLLECTION [QUERY] [--json] [--region <value>]
|
|
588
|
+
|
|
589
|
+
ARGUMENTS
|
|
590
|
+
COLLECTION The name of the collection
|
|
591
|
+
QUERY The query filter document (JSON string). If not provided, counts all documents.
|
|
592
|
+
|
|
593
|
+
GLOBAL FLAGS
|
|
594
|
+
--json Format output as json.
|
|
595
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
596
|
+
<options: amer|emea|apac>
|
|
597
|
+
|
|
598
|
+
DESCRIPTION
|
|
599
|
+
Count documents in a collection
|
|
600
|
+
|
|
601
|
+
ALIASES
|
|
602
|
+
$ aio app db doc count
|
|
603
|
+
|
|
604
|
+
EXAMPLES
|
|
605
|
+
$ aio app db document countDocuments users
|
|
606
|
+
|
|
607
|
+
$ aio app db document countDocuments users '{"age": {"$gte": 21}}'
|
|
608
|
+
|
|
609
|
+
$ aio app db document countDocuments products '{"category": "electronics"}' --json
|
|
610
|
+
|
|
611
|
+
$ aio app db doc count orders '{"status": "shipped"}'
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
## Index Management
|
|
615
|
+
|
|
616
|
+
> Note: The commands under `aio app db index <command>` are also available as `aio app db idx <command>` shorthand aliases.
|
|
617
|
+
|
|
618
|
+
### `aio app db index create COLLECTION`
|
|
619
|
+
|
|
620
|
+
Create a new index on a collection in the database
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
USAGE
|
|
624
|
+
$ aio app db index create COLLECTION [--json] [--region <value>] [-s <value>] [-k <value>] [-n <value>] [-u]
|
|
625
|
+
|
|
626
|
+
ARGUMENTS
|
|
627
|
+
COLLECTION The name of the collection to create the index on
|
|
628
|
+
|
|
629
|
+
FLAGS
|
|
630
|
+
-n, --name=<value> A name that uniquely identifies the index
|
|
631
|
+
-u, --unique Creates a unique index so that the collection will not accept insertion or update of documents where the index key value matches an
|
|
632
|
+
existing value in the index
|
|
633
|
+
|
|
634
|
+
REQUIRES AT LEAST ONE OF THE INDEX DEFINITION FLAGS
|
|
635
|
+
-k, --key=<value>... Index key to use with default specification
|
|
636
|
+
-s, --spec=<value>... Index specification as a JSON object (e.g., '{"name":1, "age":-1}')
|
|
637
|
+
|
|
638
|
+
GLOBAL FLAGS
|
|
639
|
+
--json Format output as json.
|
|
640
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
641
|
+
<options: amer|emea|apac>
|
|
642
|
+
|
|
643
|
+
DESCRIPTION
|
|
644
|
+
Create a new index on a collection in the database
|
|
645
|
+
|
|
646
|
+
ALIASES
|
|
647
|
+
$ aio app db idx create
|
|
648
|
+
|
|
649
|
+
EXAMPLES
|
|
650
|
+
$ aio app db index create users --spec '{"name":1, "age":-1}'
|
|
651
|
+
|
|
652
|
+
$ aio app db index create users -s '{"name":1, "age":-1}' --name "name_age_index"
|
|
653
|
+
|
|
654
|
+
$ aio app db index create students -s '{"name":1}' --key grade --unique
|
|
655
|
+
|
|
656
|
+
$ aio app db index create reviews -k sku -k rating
|
|
657
|
+
|
|
658
|
+
$ aio app db index create products -s '{"name":"text", "category":"text"}' --json
|
|
659
|
+
|
|
660
|
+
$ aio app db index create books -s '{"author":1}' -k year
|
|
661
|
+
|
|
662
|
+
$ aio app db idx create orders --spec '{"customerId":1}' --spec '{"orderDate":-1}' --name "customer_order_index" --unique
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### `aio app db index drop COLLECTION INDEXNAME`
|
|
666
|
+
|
|
667
|
+
Drop an index from a collection in the database
|
|
668
|
+
|
|
669
|
+
```
|
|
670
|
+
USAGE
|
|
671
|
+
$ aio app db index drop COLLECTION INDEXNAME [--json] [--region <value>]
|
|
672
|
+
|
|
673
|
+
ARGUMENTS
|
|
674
|
+
COLLECTION The name of the collection to drop the index from
|
|
675
|
+
INDEXNAME The name of the index to drop
|
|
676
|
+
|
|
677
|
+
GLOBAL FLAGS
|
|
678
|
+
--json Format output as json.
|
|
679
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
680
|
+
<options: amer|emea|apac>
|
|
681
|
+
|
|
682
|
+
DESCRIPTION
|
|
683
|
+
Drop an index from a collection in the database
|
|
684
|
+
|
|
685
|
+
ALIASES
|
|
686
|
+
$ aio app db idx drop
|
|
687
|
+
|
|
688
|
+
EXAMPLES
|
|
689
|
+
$ aio app db index drop users name_age_index
|
|
690
|
+
|
|
691
|
+
$ aio app db index drop products category_1 --json
|
|
692
|
+
|
|
693
|
+
$ aio app db idx drop orders orderDate_index
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
### `aio app db index list COLLECTION`
|
|
697
|
+
|
|
698
|
+
Get the list of indexes from a collection in the database
|
|
699
|
+
|
|
700
|
+
```
|
|
701
|
+
USAGE
|
|
702
|
+
$ aio app db index list COLLECTION [--json] [--region <value>]
|
|
703
|
+
|
|
704
|
+
ARGUMENTS
|
|
705
|
+
COLLECTION The name of the collection to retrieve indexes from
|
|
706
|
+
|
|
707
|
+
GLOBAL FLAGS
|
|
708
|
+
--json Format output as json.
|
|
709
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
710
|
+
<options: amer|emea|apac>
|
|
711
|
+
|
|
712
|
+
DESCRIPTION
|
|
713
|
+
Get the list of indexes from a collection in the database
|
|
714
|
+
|
|
715
|
+
ALIASES
|
|
716
|
+
$ aio app db idx list
|
|
717
|
+
|
|
718
|
+
EXAMPLES
|
|
719
|
+
$ aio app db index list users
|
|
720
|
+
|
|
721
|
+
$ aio app db index list products --json
|
|
722
|
+
|
|
723
|
+
$ aio app db idx list orders
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
## Database Management
|
|
727
|
+
|
|
728
|
+
### `aio app db ping`
|
|
729
|
+
|
|
730
|
+
Test connectivity to your App Builder database
|
|
731
|
+
|
|
732
|
+
```
|
|
733
|
+
USAGE
|
|
734
|
+
$ aio app db ping [--json] [--region <value>]
|
|
735
|
+
|
|
736
|
+
GLOBAL FLAGS
|
|
737
|
+
--json Format output as json.
|
|
738
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
739
|
+
<options: amer|emea|apac>
|
|
740
|
+
|
|
741
|
+
DESCRIPTION
|
|
742
|
+
Test connectivity to your App Builder database
|
|
743
|
+
|
|
744
|
+
EXAMPLES
|
|
745
|
+
$ aio app db ping
|
|
746
|
+
|
|
747
|
+
$ aio app db ping --json
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### `aio app db provision`
|
|
751
|
+
|
|
752
|
+
Provision a new database for your App Builder application
|
|
753
|
+
|
|
754
|
+
```
|
|
755
|
+
USAGE
|
|
756
|
+
$ aio app db provision [--json] [--region <value>] [-f]
|
|
757
|
+
|
|
758
|
+
FLAGS
|
|
759
|
+
-y, --yes Skip confirmation prompt and provision automatically
|
|
760
|
+
|
|
761
|
+
GLOBAL FLAGS
|
|
762
|
+
--json Format output as json.
|
|
763
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
764
|
+
<options: amer|emea|apac>
|
|
765
|
+
|
|
766
|
+
DESCRIPTION
|
|
767
|
+
Provision a new database for your App Builder application
|
|
768
|
+
|
|
769
|
+
EXAMPLES
|
|
770
|
+
$ aio app db provision
|
|
771
|
+
|
|
772
|
+
$ aio app db provision --region amer
|
|
773
|
+
|
|
774
|
+
$ aio app db provision --json
|
|
775
|
+
|
|
776
|
+
$ aio app db provision --yes
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### `aio app db delete`
|
|
780
|
+
|
|
781
|
+
Delete the database for your App Builder application (non-production only)
|
|
782
|
+
|
|
783
|
+
```
|
|
784
|
+
USAGE
|
|
785
|
+
$ aio app db delete [--json] [--region <value>] [--force]
|
|
786
|
+
|
|
787
|
+
FLAGS
|
|
788
|
+
--force [use with caution!] force delete, skips confirmation safety prompt
|
|
789
|
+
|
|
790
|
+
GLOBAL FLAGS
|
|
791
|
+
--json Format output as json.
|
|
792
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
793
|
+
<options: amer|emea|apac>
|
|
794
|
+
|
|
795
|
+
DESCRIPTION
|
|
796
|
+
Delete the database for your App Builder application (non-production only)
|
|
797
|
+
|
|
798
|
+
EXAMPLES
|
|
799
|
+
$ aio app db delete
|
|
800
|
+
|
|
801
|
+
$ aio app db delete --force
|
|
802
|
+
|
|
803
|
+
$ aio app db delete --json
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
### `aio app db status`
|
|
807
|
+
|
|
808
|
+
Check the provisioning status of your App Builder database
|
|
809
|
+
|
|
810
|
+
```
|
|
811
|
+
USAGE
|
|
812
|
+
$ aio app db status [--json] [--region <value>] [--watch]
|
|
813
|
+
|
|
814
|
+
FLAGS
|
|
815
|
+
--watch Watch for status changes (press Ctrl+C to stop)
|
|
816
|
+
|
|
817
|
+
GLOBAL FLAGS
|
|
818
|
+
--json Format output as json.
|
|
819
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
820
|
+
<options: amer|emea|apac>
|
|
821
|
+
|
|
822
|
+
DESCRIPTION
|
|
823
|
+
Check the provisioning status of your App Builder database
|
|
824
|
+
|
|
825
|
+
EXAMPLES
|
|
826
|
+
$ aio app db status
|
|
827
|
+
|
|
828
|
+
$ aio app db status --watch
|
|
829
|
+
|
|
830
|
+
$ aio app db status --json
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### `aio app db stats`
|
|
834
|
+
|
|
835
|
+
Get statistics about your App Builder database
|
|
836
|
+
|
|
837
|
+
```
|
|
838
|
+
USAGE
|
|
839
|
+
$ aio app db stats [--json] [--region <value>]
|
|
840
|
+
|
|
841
|
+
GLOBAL FLAGS
|
|
842
|
+
--json Format output as json.
|
|
843
|
+
--region=<value> Database region. Defaults to 'AIO_DB_REGION' environment variable or 'amer' if neither is set.
|
|
844
|
+
<options: amer|emea|apac>
|
|
845
|
+
|
|
846
|
+
DESCRIPTION
|
|
847
|
+
Get statistics about your App Builder database
|
|
848
|
+
|
|
849
|
+
EXAMPLES
|
|
850
|
+
$ aio app db stats
|
|
851
|
+
|
|
852
|
+
$ aio app db stats --json
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
# Other Commands
|
|
856
|
+
|
|
193
857
|
## `aio help [COMMAND]`
|
|
194
858
|
|
|
195
859
|
Display help for aio.
|