> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cli/reference/db.md).

# norbix db

Database records, schemas, schema triggers, integrations, taxonomies and terms, test data.

Database records, schemas, schema triggers, integrations, taxonomies and terms, test data.

42 commands (`@norbix.ai/cli` 1.16.0):

* [`norbix db aggregate`](#norbix-db-aggregate) — Run an aggregation: an inline pipeline, or a saved aggregate by ID
* [`norbix db aggregates`](#norbix-db-aggregates) — List saved database aggregates
* [`norbix db change-owner`](#norbix-db-change-owner) — Hand a record to another user
* [`norbix db count`](#norbix-db-count) — Count records in a collection
* [`norbix db delete`](#norbix-db-delete) — Delete records: one by --id, many by --filter with --many, or every record with --all
* [`norbix db distinct`](#norbix-db-distinct) — List the distinct values of one field in a collection
* [`norbix db find`](#norbix-db-find) — Find records in a collection (MongoDB-style filter)
* [`norbix db get`](#norbix-db-get) — Get one record by ID
* [`norbix db indexes`](#norbix-db-indexes) — List the indexes of a collection
* [`norbix db insert`](#norbix-db-insert) — Insert one record into a collection
* [`norbix db insert-many`](#norbix-db-insert-many) — Insert many records at once (JSON array)
* [`norbix db integration`](#norbix-db-integration) — Show one database integration
* [`norbix db integration default`](#norbix-db-integration-default) — Make a database integration the default one for this project
* [`norbix db integration test`](#norbix-db-integration-test) — Check that a database integration can be reached
* [`norbix db integrations`](#norbix-db-integrations) — List the database integrations (the databases this project stores records in)
* [`norbix db replace`](#norbix-db-replace) — Replace one record fully (unlike update, the whole document is swapped)
* [`norbix db schema`](#norbix-db-schema) — Show one database schema
* [`norbix db schema create`](#norbix-db-schema-create) — Create a database schema (a collection) from a JSON file
* [`norbix db schema delete`](#norbix-db-schema-delete) — Delete a database schema and its records
* [`norbix db schema diff`](#norbix-db-schema-diff) — Show what changed between two versions of a database schema
* [`norbix db schema discard`](#norbix-db-schema-discard) — Throw away the unpublished draft of a database schema
* [`norbix db schema draft`](#norbix-db-schema-draft) — Show the unpublished draft of a database schema
* [`norbix db schema publish`](#norbix-db-schema-publish) — Publish the draft of a database schema
* [`norbix db schema update`](#norbix-db-schema-update) — Change a database schema from a JSON file
* [`norbix db schema versions`](#norbix-db-schema-versions) — List the published versions of a database schema
* [`norbix db schemas`](#norbix-db-schemas) — List database schemas (collections definitions)
* [`norbix db seed`](#norbix-db-seed) — Fill several collections with test records in one call
* [`norbix db taxonomies`](#norbix-db-taxonomies) — List database taxonomies
* [`norbix db taxonomy`](#norbix-db-taxonomy) — Show one database taxonomy
* [`norbix db term`](#norbix-db-term) — Show one taxonomy term
* [`norbix db term create`](#norbix-db-term-create) — Add one term to a taxonomy
* [`norbix db term delete`](#norbix-db-term-delete) — Delete one taxonomy term
* [`norbix db term tree`](#norbix-db-term-tree) — Show the terms of a taxonomy as a tree
* [`norbix db term update`](#norbix-db-term-update) — Change some fields of one taxonomy term
* [`norbix db terms`](#norbix-db-terms) — List the terms of a taxonomy
* [`norbix db trigger`](#norbix-db-trigger) — Show one schema trigger
* [`norbix db trigger create`](#norbix-db-trigger-create) — Create or update a schema trigger from a JSON file
* [`norbix db trigger delete`](#norbix-db-trigger-delete) — Delete a schema trigger
* [`norbix db trigger disable`](#norbix-db-trigger-disable) — Turn a schema trigger off
* [`norbix db trigger enable`](#norbix-db-trigger-enable) — Turn a schema trigger on
* [`norbix db triggers`](#norbix-db-triggers) — List schema triggers (actions that run when records change)
* [`norbix db update`](#norbix-db-update) — Update records: one by --id, many by --filter with --many, or every record with --all

## `norbix db aggregate`

Run an aggregation: an inline pipeline, or a saved aggregate by ID

```sh
norbix db aggregate COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                   | Description                                  |
| ---------------------- | -------------------------------------------- |
| `--pipeline` `<value>` | JSON aggregation pipeline (or `-` for stdin) |
| `--id` `<value>`       | Saved aggregate ID (runs executeAggregate)   |
| `--tokens` `<value>`   | JSON object of tokens for a saved aggregate  |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db aggregate orders --pipeline '[{"$group":{"_id":"$status","n":{"$sum":1}}}]'
norbix db aggregate orders --id 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db aggregates`

List saved database aggregates

```sh
norbix db aggregates [flags]
```

| Flag                 | Description                       |
| -------------------- | --------------------------------- |
| `--schema` `<value>` | Only aggregates of this schema ID |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db aggregates
norbix db aggregates --schema 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db change-owner`

Hand a record to another user

```
The record's owner (the responsible user) decides who may read or change it
under "own" permissions.
```

```sh
norbix db change-owner COLLECTION ID [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |
| `ID`         | yes      | Record ID       |

| Flag                      | Description                                                            |
| ------------------------- | ---------------------------------------------------------------------- |
| `--dry-run`               | Resolve context and print the request that would be sent; send nothing |
| `--integration` `<value>` | Database integration ID (default: the project default integration)     |
| `-u`, `--user` `<value>`  | ID of the user who becomes the owner — required                        |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db change-owner orders 66b2f0a1c3d4e5f6a7b8c9d0 --user 66b2f0a1c3d4e5f6a7b8c9d1
norbix db change-owner orders 66b2f0a1c3d4e5f6a7b8c9d0 --user 66b2f0a1c3d4e5f6a7b8c9d1 --dry-run
```

## `norbix db count`

Count records in a collection

```sh
norbix db count COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                       | Description                    |
| -------------------------- | ------------------------------ |
| `-f`, `--filter` `<value>` | JSON filter (or `-` for stdin) |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db count orders
norbix db count orders --filter '{"status":"paid"}'
```

## `norbix db delete`

Delete records: one by --id, many by --filter with --many, or every record with --all

```
An empty filter ('{}') is refused: it would delete the whole collection. Use
--all to do that on purpose. A caller with only "delete own" rights deletes
only the records it owns.
```

```sh
norbix db delete COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                       | Description                                                            |
| -------------------------- | ---------------------------------------------------------------------- |
| `--id` `<value>`           | Record ID (single delete)                                              |
| `-f`, `--filter` `<value>` | JSON filter (with --many); must not be empty                           |
| `--many`                   | Delete every record matching --filter                                  |
| `--all`                    | Delete EVERY record of the collection (sends allRecords: true)         |
| `-y`, `--yes`              | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`                | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db delete orders --id 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
norbix db delete orders --id 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db delete orders --filter '{"status":"cancelled"}' --many --yes
norbix db delete orders --all --dry-run
```

## `norbix db distinct`

List the distinct values of one field in a collection

```sh
norbix db distinct COLLECTION FIELD [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |
| `FIELD`      | yes      | Field name      |

| Flag                       | Description                    |
| -------------------------- | ------------------------------ |
| `-f`, `--filter` `<value>` | JSON filter (or `-` for stdin) |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db distinct orders status --filter '{"total":{"$gt":10}}'
```

## `norbix db find`

Find records in a collection (MongoDB-style filter)

```sh
norbix db find COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                       | Description                             |
| -------------------------- | --------------------------------------- |
| `-f`, `--filter` `<value>` | JSON filter (or `-` for stdin)          |
| `--page-size` `<value>`    | Records per page                        |
| `--after` `<value>`        | Cursor: fetch the page after this item  |
| `--before` `<value>`       | Cursor: fetch the page before this item |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db find orders
norbix db find orders --filter '{"status":"paid"}' --page-size 20
norbix db find orders --json | jq '.list.items'
```

## `norbix db get`

Get one record by ID

```sh
norbix db get COLLECTION ID
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |
| `ID`         | yes      | Record ID       |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db get orders 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db indexes`

List the indexes of a collection

```sh
norbix db indexes COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                      | Description                                                        |
| ------------------------- | ------------------------------------------------------------------ |
| `--integration` `<value>` | Database integration ID (default: the project default integration) |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db indexes orders
```

## `norbix db insert`

Insert one record into a collection

```sh
norbix db insert COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                    | Description                                                            |
| ----------------------- | ---------------------------------------------------------------------- |
| `--dry-run`             | Resolve context and print the request that would be sent; send nothing |
| `-d`, `--doc` `<value>` | JSON document (or `-` for stdin) — required                            |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db insert orders --doc '{"status":"new","total":9.99}'
cat order.json | norbix db insert orders --doc -
norbix db insert orders --doc '{"status":"new","total":9.99}' --dry-run
```

## `norbix db insert-many`

Insert many records at once (JSON array)

```sh
norbix db insert-many COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                     | Description                                                            |
| ------------------------ | ---------------------------------------------------------------------- |
| `--dry-run`              | Resolve context and print the request that would be sent; send nothing |
| `-d`, `--docs` `<value>` | JSON array of documents (or `-` for stdin) — required                  |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db insert-many orders --docs '[{"a":1},{"a":2}]'
cat orders.json | norbix db insert-many orders --docs -
norbix db insert-many orders --docs '[{"a":1},{"a":2}]' --dry-run
```

## `norbix db integration`

Show one database integration

```sh
norbix db integration ID
```

| Argument | Required | Description    |
| -------- | -------- | -------------- |
| `ID`     | yes      | Integration ID |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db integration 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db integration default`

Make a database integration the default one for this project

```
Commands without --integration read and write the default integration.
```

```sh
norbix db integration default ID [flags]
```

| Argument | Required | Description    |
| -------- | -------- | -------------- |
| `ID`     | yes      | Integration ID |

| Flag        | Description                                                            |
| ----------- | ---------------------------------------------------------------------- |
| `--dry-run` | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db integration default 66b2f0a1c3d4e5f6a7b8c9d0
norbix db integration default 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db integration test`

Check that a database integration can be reached

```
The server connects to the database behind the integration and reports
whether it answers. Nothing is written.
```

```sh
norbix db integration test ID
```

| Argument | Required | Description    |
| -------- | -------- | -------------- |
| `ID`     | yes      | Integration ID |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db integration test 66b2f0a1c3d4e5f6a7b8c9d0
norbix db integration test 66b2f0a1c3d4e5f6a7b8c9d0 --json
```

## `norbix db integrations`

List the database integrations (the databases this project stores records in)

```sh
norbix db integrations [flags]
```

| Flag                    | Description                             |
| ----------------------- | --------------------------------------- |
| `--page-size` `<value>` | Integrations per page                   |
| `--after` `<value>`     | Cursor: fetch the page after this item  |
| `--before` `<value>`    | Cursor: fetch the page before this item |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db integrations
```

## `norbix db replace`

Replace one record fully (unlike update, the whole document is swapped)

```sh
norbix db replace COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                    | Description                                                            |
| ----------------------- | ---------------------------------------------------------------------- |
| `--dry-run`             | Resolve context and print the request that would be sent; send nothing |
| `--id` `<value>`        | Record ID — required                                                   |
| `-d`, `--doc` `<value>` | JSON replacement document (or `-` for stdin) — required                |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db replace orders --id 66b2f0a1c3d4e5f6a7b8c9d0 --doc '{"status":"new"}'
norbix db replace orders --id 66b2f0a1c3d4e5f6a7b8c9d0 --doc '{"status":"new"}' --dry-run
```

## `norbix db schema`

Show one database schema

```sh
norbix db schema ID
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db schema create`

Create a database schema (a collection) from a JSON file

```
--file is the data schema (JSON Schema of one record). --ui-file is the
optional UI schema the dashboard form uses. The schema starts as a draft:
run `db schema publish <id>` to make the collection usable.
```

```sh
norbix db schema create [flags]
```

| Flag                   | Description                                                            |
| ---------------------- | ---------------------------------------------------------------------- |
| `--dry-run`            | Resolve context and print the request that would be sent; send nothing |
| `--name` `<value>`     | Schema (collection) name — required                                    |
| `--file` `<value>`     | Data schema JSON file (or `-` for stdin) — required                    |
| `--ui-file` `<value>`  | UI schema JSON file                                                    |
| `--settings` `<value>` | Schema settings as a JSON object — inline, @file or -                  |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema create --name orders --file orders.schema.json
norbix db schema create --name orders --file orders.schema.json --ui-file orders.ui.json
norbix db schema create --name orders --file orders.schema.json --dry-run
```

## `norbix db schema delete`

Delete a database schema and its records

```
The schema's records (its collection, with its indexes) in this environment are
dropped too, and removed from the AI knowledge when AI embed is on. There is no
undo. The delete is refused while a schema trigger (CM-ERRORS-SCHEMA-017) or a
saved aggregate (CM-ERRORS-SCHEMA-018) uses the schema; then nothing is dropped.
```

```sh
norbix db schema delete ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema delete 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db schema delete 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db schema diff`

Show what changed between two versions of a database schema

```sh
norbix db schema diff ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

| Flag               | Description                     |
| ------------------ | ------------------------------- |
| `--from` `<value>` | Older version number — required |
| `--to` `<value>`   | Newer version number — required |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema diff 66b2f0a1c3d4e5f6a7b8c9d0 --from 1 --to 2
```

## `norbix db schema discard`

Throw away the unpublished draft of a database schema

```sh
norbix db schema discard ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema discard 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db schema discard 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db schema draft`

Show the unpublished draft of a database schema

```sh
norbix db schema draft ID
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema draft 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db schema publish`

Publish the draft of a database schema

```
Records are validated against the published version from now on. Check the
change first with `db schema draft <id>` or `db schema diff`.
```

```sh
norbix db schema publish ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema publish 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db schema publish 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db schema update`

Change a database schema from a JSON file

```
The change is saved as the schema's draft; records keep using the published
version until you run `db schema publish <id>`. `db schema draft <id>` shows
the draft, `db schema discard <id>` throws it away.
```

```sh
norbix db schema update ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

| Flag                  | Description                                                            |
| --------------------- | ---------------------------------------------------------------------- |
| `--dry-run`           | Resolve context and print the request that would be sent; send nothing |
| `--file` `<value>`    | Data schema JSON file (or `-` for stdin)                               |
| `--ui-file` `<value>` | UI schema JSON file                                                    |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema update 66b2f0a1c3d4e5f6a7b8c9d0 --file orders.schema.json
norbix db schema update 66b2f0a1c3d4e5f6a7b8c9d0 --ui-file orders.ui.json
norbix db schema update 66b2f0a1c3d4e5f6a7b8c9d0 --file orders.schema.json --dry-run
```

## `norbix db schema versions`

List the published versions of a database schema

```sh
norbix db schema versions ID
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Schema ID   |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schema versions 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db schemas`

List database schemas (collections definitions)

```sh
norbix db schemas [flags]
```

| Flag                    | Description                            |
| ----------------------- | -------------------------------------- |
| `--page-size` `<value>` | Records per page                       |
| `--after` `<value>`     | Cursor: fetch the page after this item |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db schemas
```

## `norbix db seed`

Fill several collections with test records in one call

```
The server reads the published schemas, inserts parents before children and
puts real record ids into reference fields. --collections is a JSON array:

  dummy mode (default):  [{"collectionName":"families","count":3}]
  realistic mode:        [{"collectionName":"pairs","documents":[{...}]}]

In realistic mode a reference to another seeded collection is written as
{"$seedRef":{"collection":"<name>","index":<n>}}. All or nothing: every
document is validated first. The report lists the ids inserted per collection.
```

```sh
norbix db seed [flags]
```

| Flag                            | Description                                                            |
| ------------------------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes`                   | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`                     | Resolve context and print the request that would be sent; send nothing |
| `--integration` `<value>`       | Database integration ID (default: the project default integration)     |
| `-c`, `--collections` `<value>` | JSON array — inline, @file or - — required                             |
| `--mode` `<value>`              | Seeding mode — one of: `dummy`, `realistic`; default: `dummy`          |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db seed --collections '[{"collectionName":"orders","count":5}]' --yes
norbix db seed --mode realistic --collections @seed.json --yes
norbix db seed --collections '[{"collectionName":"orders","count":5}]' --dry-run
```

## `norbix db taxonomies`

List database taxonomies

```sh
norbix db taxonomies [flags]
```

| Flag                    | Description                            |
| ----------------------- | -------------------------------------- |
| `--page-size` `<value>` | Records per page                       |
| `--after` `<value>`     | Cursor: fetch the page after this item |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db taxonomies
```

## `norbix db taxonomy`

Show one database taxonomy

```sh
norbix db taxonomy ID
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Taxonomy ID |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db taxonomy 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db term`

Show one taxonomy term

```sh
norbix db term TAXONOMYID ID [flags]
```

| Argument     | Required | Description |
| ------------ | -------- | ----------- |
| `TAXONOMYID` | yes      | Taxonomy ID |
| `ID`         | yes      | Term ID     |

| Flag                      | Description                                                        |
| ------------------------- | ------------------------------------------------------------------ |
| `--integration` `<value>` | Database integration ID (default: the project default integration) |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db term 66b2f0a1c3d4e5f6a7b8c9d0 66b2f0a1c3d4e5f6a7b8c9d1
```

## `norbix db term create`

Add one term to a taxonomy

```sh
norbix db term create TAXONOMYID [flags]
```

| Argument     | Required | Description |
| ------------ | -------- | ----------- |
| `TAXONOMYID` | yes      | Taxonomy ID |

| Flag                      | Description                                                            |
| ------------------------- | ---------------------------------------------------------------------- |
| `--dry-run`               | Resolve context and print the request that would be sent; send nothing |
| `--integration` `<value>` | Database integration ID (default: the project default integration)     |
| `-d`, `--doc` `<value>`   | The term as JSON — inline, @file or - — required                       |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db term create 66b2f0a1c3d4e5f6a7b8c9d0 --doc '{"name":"Lithuania","order":1}'
norbix db term create 66b2f0a1c3d4e5f6a7b8c9d0 --doc @term.json
norbix db term create 66b2f0a1c3d4e5f6a7b8c9d0 --doc '{"name":"Lithuania"}' --dry-run
```

## `norbix db term delete`

Delete one taxonomy term

```sh
norbix db term delete TAXONOMYID ID [flags]
```

| Argument     | Required | Description |
| ------------ | -------- | ----------- |
| `TAXONOMYID` | yes      | Taxonomy ID |
| `ID`         | yes      | Term ID     |

| Flag                      | Description                                                            |
| ------------------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes`             | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`               | Resolve context and print the request that would be sent; send nothing |
| `--integration` `<value>` | Database integration ID (default: the project default integration)     |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db term delete 66b2f0a1c3d4e5f6a7b8c9d0 66b2f0a1c3d4e5f6a7b8c9d1 --yes
norbix db term delete 66b2f0a1c3d4e5f6a7b8c9d0 66b2f0a1c3d4e5f6a7b8c9d1 --dry-run
```

## `norbix db term tree`

Show the terms of a taxonomy as a tree

```
--merged also folds in the terms of the parent taxonomies (one tree across
the taxonomy chain).
```

```sh
norbix db term tree TAXONOMY [flags]
```

| Argument   | Required | Description   |
| ---------- | -------- | ------------- |
| `TAXONOMY` | yes      | Taxonomy name |

| Flag                      | Description                                                        |
| ------------------------- | ------------------------------------------------------------------ |
| `--integration` `<value>` | Database integration ID (default: the project default integration) |
| `--root` `<value>`        | Start the tree at this term ID                                     |
| `--depth` `<value>`       | How many levels to return                                          |
| `--merged`                | Merge the parent taxonomies into one tree                          |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db term tree countries
norbix db term tree countries --root 66b2f0a1c3d4e5f6a7b8c9d0 --depth 2
norbix db term tree cities --merged
```

## `norbix db term update`

Change some fields of one taxonomy term

```
--set is a JSON object of the fields to change (applied with $set): name,
description, order, parentId, multiParents. Fields you leave out keep their value.
```

```sh
norbix db term update TAXONOMYID ID [flags]
```

| Argument     | Required | Description |
| ------------ | -------- | ----------- |
| `TAXONOMYID` | yes      | Taxonomy ID |
| `ID`         | yes      | Term ID     |

| Flag                      | Description                                                            |
| ------------------------- | ---------------------------------------------------------------------- |
| `--dry-run`               | Resolve context and print the request that would be sent; send nothing |
| `--integration` `<value>` | Database integration ID (default: the project default integration)     |
| `-s`, `--set` `<value>`   | Fields to change as JSON — inline, @file or - — required               |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db term update 66b2f0a1c3d4e5f6a7b8c9d0 66b2f0a1c3d4e5f6a7b8c9d1 --set '{"order":1}'
norbix db term update 66b2f0a1c3d4e5f6a7b8c9d0 66b2f0a1c3d4e5f6a7b8c9d1 --set @patch.json --dry-run
```

## `norbix db terms`

List the terms of a taxonomy

```
Pass --parent to list only the children of one term.
```

```sh
norbix db terms TAXONOMY [flags]
```

| Argument   | Required | Description   |
| ---------- | -------- | ------------- |
| `TAXONOMY` | yes      | Taxonomy name |

| Flag                       | Description                                                        |
| -------------------------- | ------------------------------------------------------------------ |
| `--integration` `<value>`  | Database integration ID (default: the project default integration) |
| `-f`, `--filter` `<value>` | JSON filter (or `-` for stdin)                                     |
| `--parent` `<value>`       | List only the children of this term ID                             |
| `--page-size` `<value>`    | Terms per page                                                     |
| `--after` `<value>`        | Cursor: fetch the page after this item                             |
| `--before` `<value>`       | Cursor: fetch the page before this item                            |
| `--desc`                   | Sort descending                                                    |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db terms countries
norbix db terms countries --filter '{"name":"Lithuania"}'
norbix db terms countries --parent 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db trigger`

Show one schema trigger

```sh
norbix db trigger ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Trigger ID  |

| Flag                 | Description                      |
| -------------------- | -------------------------------- |
| `--schema` `<value>` | Schema ID the trigger belongs to |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db trigger 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db trigger create`

Create or update a schema trigger from a JSON file

```
The file holds the trigger: name, schemaId, the record events it reacts to,
and an action ({type, ...}) — the same shape `db trigger <id> --json` shows.
"type" is set to "Schema" when the file leaves it out. --schema sets schemaId,
--id sets triggerId (update instead of create).
```

```sh
norbix db trigger create [flags]
```

| Flag                 | Description                                                            |
| -------------------- | ---------------------------------------------------------------------- |
| `--dry-run`          | Resolve context and print the request that would be sent; send nothing |
| `--file` `<value>`   | Trigger JSON file (or `-` for stdin) — required                        |
| `--schema` `<value>` | Schema ID (overrides schemaId in the file)                             |
| `--id` `<value>`     | Trigger ID — set it to update instead of create                        |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db trigger create --file trigger.json
norbix db trigger create --file trigger.json --schema 66b2f0a1c3d4e5f6a7b8c9d0
cat trigger.json | norbix db trigger create --file -
norbix db trigger create --file trigger.json --dry-run
```

## `norbix db trigger delete`

Delete a schema trigger

```sh
norbix db trigger delete ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Trigger ID  |

| Flag                 | Description                                                            |
| -------------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes`        | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`          | Resolve context and print the request that would be sent; send nothing |
| `--schema` `<value>` | Schema ID the trigger belongs to                                       |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db trigger delete 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db trigger delete 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db trigger disable`

Turn a schema trigger off

```sh
norbix db trigger disable ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Trigger ID  |

| Flag                 | Description                                                            |
| -------------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes`        | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`          | Resolve context and print the request that would be sent; send nothing |
| `--schema` `<value>` | Schema ID the trigger belongs to                                       |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db trigger disable 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix db trigger disable 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db trigger enable`

Turn a schema trigger on

```sh
norbix db trigger enable ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Trigger ID  |

| Flag                 | Description                                                            |
| -------------------- | ---------------------------------------------------------------------- |
| `--dry-run`          | Resolve context and print the request that would be sent; send nothing |
| `--schema` `<value>` | Schema ID the trigger belongs to                                       |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db trigger enable 66b2f0a1c3d4e5f6a7b8c9d0
norbix db trigger enable 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix db triggers`

List schema triggers (actions that run when records change)

```sh
norbix db triggers [flags]
```

| Flag                    | Description                             |
| ----------------------- | --------------------------------------- |
| `--schema` `<value>`    | Only the triggers of this schema ID     |
| `--page-size` `<value>` | Triggers per page                       |
| `--after` `<value>`     | Cursor: fetch the page after this item  |
| `--before` `<value>`    | Cursor: fetch the page before this item |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db triggers
norbix db triggers --schema 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix db update`

Update records: one by --id, many by --filter with --many, or every record with --all

```
--update is the plain fields to change, e.g. {"status":"paid"}; the gateway
applies them with $set. Operators ($set, $inc, …) are refused. An empty filter
('{}') is refused: it would change the whole collection. Use --all to do that
on purpose. Soft-deleted records are not changed.
```

```sh
norbix db update COLLECTION [flags]
```

| Argument     | Required | Description     |
| ------------ | -------- | --------------- |
| `COLLECTION` | yes      | Collection name |

| Flag                       | Description                                                                              |
| -------------------------- | ---------------------------------------------------------------------------------------- |
| `--id` `<value>`           | Record ID (single update)                                                                |
| `-f`, `--filter` `<value>` | JSON filter (with --many); must not be empty                                             |
| `-u`, `--update` `<value>` | JSON object of the fields to change (e.g. {"status":"paid"}) or `-` for stdin — required |
| `--many`                   | Update every record matching --filter                                                    |
| `--all`                    | Update EVERY record of the collection (sends allRecords: true)                           |
| `-y`, `--yes`              | Skip the confirmation prompt (required in non-interactive shells)                        |
| `--dry-run`                | Resolve context and print the request that would be sent; send nothing                   |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix db update orders --id 66b2f0a1c3d4e5f6a7b8c9d0 --update '{"status":"shipped"}'
norbix db update orders --filter '{"status":"new"}' --update '{"status":"queued"}' --many --dry-run
norbix db update orders --filter '{"status":"new"}' --update '{"status":"queued"}' --many --yes
norbix db update orders --all --update '{"archived":true}' --dry-run
```
