@adobe/aio-cli-plugin-app-storage 1.1.0 → 1.2.0-pre.2026-02-12.sha-de5341b6

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