# 7.3.42. `object_list`

## 7.3.42.1. Summary

New in version 6.0.7.

`object_list` lists objects in database. Object information is taken from metadata in database. `object_list` doesn’t open any objects. So `object_list` is a light command for database that has many tables and/or columns.

Normally, schema is a useful command than `object_list`. Because schema returns more information than `object_list`.

## 7.3.42.2. Syntax

This command takes no parameters:

    object_list

## 7.3.42.3. Usage

Here is an example schema to show example output:

Execution example:

    table_create Memos TABLE_HASH_KEY ShortText
    # [[0, 1337566253.89858, 0.000355720520019531], true]
    column_create Memos content COLUMN_SCALAR Text
    # [[0, 1337566253.89858, 0.000355720520019531], true]
    table_create Terms TABLE_PAT_KEY ShortText \
      --default_tokenizer TokenBigram \
      --normalizer NormalizerAuto
    # [[0, 1337566253.89858, 0.000355720520019531], true]
    column_create Terms memos_content_index \
      COLUMN_INDEX|WITH_POSITION \
      Memos content
    # [[0, 1337566253.89858, 0.000355720520019531], true]

Here is an output of `object_list` command against this database:

Execution example:

    object_list
    # [
    #   [
    #     0,
    #     1337566253.89858,
    #     0.000355720520019531
    #   ],
    #   {
    #     "UInt64": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 11,
    #       "name": "UInt64"
    #     },
    #     "Int32": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_INT",
    #         "value": 8
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 4,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 8,
    #       "name": "Int32"
    #     },
    #     "Int16": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_INT",
    #         "value": 8
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 2,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 6,
    #       "name": "Int16"
    #     },
    #     "Float": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_FLOAT",
    #         "value": 16
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 12,
    #       "name": "Float"
    #     },
    #     "LongText": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_VAR_SIZE",
    #         "value": 16384
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 2147483648,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 16,
    #       "name": "LongText"
    #     },
    #     "TokyoGeoPoint": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_GEO_POINT",
    #         "value": 24
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 17,
    #       "name": "TokyoGeoPoint"
    #     },
    #     "Text": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_VAR_SIZE",
    #         "value": 16384
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 65536,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 15,
    #       "name": "Text"
    #     },
    #     "ShortText": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_VAR_SIZE",
    #         "value": 16384
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 4096,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 14,
    #       "name": "ShortText"
    #     },
    #     "Object": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 2,
    #       "name": "Object"
    #     },
    #     "Terms.memos_content_index": {
    #       "opened": true,
    #       "sources": [
    #         {
    #           "id": 257,
    #           "name": "Memos.content"
    #         }
    #       ],
    #       "range": {
    #         "id": 256,
    #         "name": "Memos"
    #       },
    #       "flags": {
    #         "names": "COLUMN_INDEX|WITH_POSITION|PERSISTENT",
    #         "value": 33282
    #       },
    #       "n_elements": 4,
    #       "path": "/tmp/groonga-databases/commands_object_list.0000103",
    #       "type": {
    #         "id": 72,
    #         "name": "column:index"
    #       },
    #       "id": 259,
    #       "name": "Terms.memos_content_index"
    #     },
    #     "UInt8": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 1,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 5,
    #       "name": "UInt8"
    #     },
    #     "UInt32": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 4,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 9,
    #       "name": "UInt32"
    #     },
    #     "Terms": {
    #       "opened": true,
    #       "token_filters": [],
    #       "range": {
    #         "id": 0,
    #         "name": null
    #       },
    #       "flags": {
    #         "names": "TABLE_PAT_KEY|PERSISTENT",
    #         "value": 49153
    #       },
    #       "n_elements": 5,
    #       "path": "/tmp/groonga-databases/commands_object_list.0000102",
    #       "type": {
    #         "id": 49,
    #         "name": "table:pat_key"
    #       },
    #       "id": 258,
    #       "name": "Terms"
    #     },
    #     "UInt16": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 2,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 7,
    #       "name": "UInt16"
    #     },
    #     "Bool": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_UINT",
    #         "value": 0
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 1,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 3,
    #       "name": "Bool"
    #     },
    #     "Memos.content": {
    #       "opened": true,
    #       "range": {
    #         "id": 15,
    #         "name": "Text"
    #       },
    #       "flags": {
    #         "names": "COLUMN_SCALAR|PERSISTENT",
    #         "value": 49152
    #       },
    #       "n_elements": 4,
    #       "path": "/tmp/groonga-databases/commands_object_list.0000101",
    #       "type": {
    #         "id": 65,
    #         "name": "column:var_size"
    #       },
    #       "id": 257,
    #       "name": "Memos.content"
    #     },
    #     "Time": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_INT",
    #         "value": 8
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 13,
    #       "name": "Time"
    #     },
    #     "Int64": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_INT",
    #         "value": 8
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 10,
    #       "name": "Int64"
    #     },
    #     "WGS84GeoPoint": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_GEO_POINT",
    #         "value": 24
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 8,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 18,
    #       "name": "WGS84GeoPoint"
    #     },
    #     "Memos": {
    #       "opened": true,
    #       "token_filters": [],
    #       "range": {
    #         "id": 0,
    #         "name": null
    #       },
    #       "flags": {
    #         "names": "TABLE_HASH_KEY|PERSISTENT",
    #         "value": 49152
    #       },
    #       "n_elements": 5,
    #       "path": "/tmp/groonga-databases/commands_object_list.0000100",
    #       "type": {
    #         "id": 48,
    #         "name": "table:hash_key"
    #       },
    #       "id": 256,
    #       "name": "Memos"
    #     },
    #     "Int8": {
    #       "opened": true,
    #       "flags": {
    #         "names": "KEY_INT",
    #         "value": 8
    #       },
    #       "n_elements": 4,
    #       "path": null,
    #       "size": 1,
    #       "type": {
    #         "id": 32,
    #         "name": "type"
    #       },
    #       "id": 4,
    #       "name": "Int8"
    #     }
    #   }
    # ]

## 7.3.42.4. Parameters

This section describes all parameters.

### 7.3.42.4.1. Required parameters

There is no required parameter.

### 7.3.42.4.2. Optional parameters

There is no optional parameter.

## 7.3.42.5. Return value

`object_list` command returns a list of object information in the database:

    [HEADER, OBJECTS]

### 7.3.42.5.1. `HEADER`

See Output format about `HEADER`.

### 7.3.42.5.2. `OBJECTS`

`OBJECTS` are pairs of object name and object details:

    {
      "OBJECT_1": OBJECT_1,
      "OBJECT_2": OBJECT_2,
      ...,
      "OBJECT_n": OBJECT_n,
    }

Each `OBJECT` consists of common properties and object type specific properties.

### 7.3.42.5.3. `OBJECT` (common properties)

Here are common properties:

    {
      "id":         ID,
      "name":       NAME,
      "opened":     OPENED,
      "value_size": N_BYTES,
      "n_elements": N_ELEMENTS,
      "type":       OBJECT_TYPE,
      "flags":      FLAGS,
      "path":       PATH
    }

Name | Description
--- | ---
`id` | The ID of the object.
`name` | The name of the object.
`opened` | Whether the object is opened or not. It’s `true` or `false`. If the object is opened, this value is `true`. Otherwise, this value is `false`.
`value_size` | The number of bytes of the metadata. It’s an integer. It’s appeared only when the metadata are broken. If this property is appeared, `type`, `n_elements`, `flags` and `path` aren’t appeared. Because they can’t be retrieved from broken metadata.
`n_elements` | The number of internal elements in the metadata. It’s an integer.
`type` | The type of the object. See OBJECT_TYPE for details.
`flags` | The flags of the object. See FLAGS for details.
`path` | The path that contains data of the object. It’s `null` for objects that doesn’t have data. For example, command object doesn’t have data.

### 7.3.42.5.4. `OBJECT_TYPE`

`OBJECT_TYPE` represents the type of object. For example, patricia trie table, hash table and index column are object types.

`OBJECT_TYPE` has the following properties:

    {
      "id":   ID,
      "name": NAME
    }

Name | Description
--- | ---
`id` | The ID of the type.
`name` | The name of the type. For example, TABLE_HASH_KEY is `"table:hash_key"`, Vector column is `"column:var_size"` and Index column is `"column:index"`.

### 7.3.42.5.5. `FLAGS`

`FLAGS` represents the flags of object. The most flags are the specified flags in table_create or column_create. Some flags are added internally.

`FLAGS` has the following properties:

    {
      "value": VALUE,
      "names": NAMES
    }

Name | Description
--- | ---
`value` | The value of the flags. It’s an integer.
`names` | The names of each flag. It’s a string. Each name is separated by `|` such as `TABLE_HASH_KEY|PERSISTENT`.

### 7.3.42.5.6. `OBJECT` (`"type"` object type specific properties)

Here are `"type"` object type specific properties in `OBJECT`:

    {
      "size": SIZE
    }

Name | Description
--- | ---
`size` | The size of the type. If the type is fixed size type, the size is the size of each value. If the type is variable size type, the size is the maximum size of each value.

### 7.3.42.5.7. `OBJECT` (`"proc"` object type specific properties)

Here is a list of object that is `"proc"` object type:

> - Command

> - Function

> - Normalizers

> - Tokenizers

> - Token filters

Here are `"proc"` object type specific properties in `OBJECT`:

    {
      "plugin_id": PLUGIN_ID
    }

Name | Description
--- | ---
`plugin_id` | The plugin ID of the `"proc"` object. If the `"proc"` object is defined by plugin, the value is `1` or more larger integer. Plugin ID is `0` for builtin `"proc"` object.

### 7.3.42.5.8. `OBJECT` (`"table:*"` object types specific properties)

Here are `"table:*"` object types specific properties in `OBJECT`:

    {
      "range":         RANGE,
      "token_filters": TOKEN_FILTERS
    }

Name | Description
--- | ---
`range` | The type of the table’s value. See RANGE for details.
`token_filters` | The token filters of the table. See TOKEN_FILTERS for details.

### 7.3.42.5.9. `RANGE`

`RANGE` represents the type of the range.

`RANGE` has the following properties:

    {
      "id":   ID,
      "name": NAME
    }

Name | Description
--- | ---
`id` | The ID of the type of the range. It’s an integer. If the object doesn’t have range, ID is `0`.
`name` | The name of the type of the range. It’s a string or `null`. If the object doesn’t have range, name is `null`.

### 7.3.42.5.10. `TOKEN_FILTERS`

`TOKEN_FILTERS` represents the token filters of the table.

`TOKEN_FILTERS` is an array of `TOKEN_FILTER`:

    [
      TOKEN_FILTER_1,
      TOKEN_FILTER_2,
      ...,
      TOKEN_FILTER_n
    ]

`TOKEN_FILTER` has the following properties:

    {
      "id":   ID,
      "NAME": NAME
    }

Name | Description
--- | ---
`id` | The ID of the token filter. It’s an integer.
`name` | The name of the token filter. It’s a string.

### 7.3.42.5.11. `OBJECT` (`"column:*"` object types specific properties)

Here are `"column:*"` object types specific properties in `OBJECT`:

    {
      "range": RANGE
    }

Name | Description
--- | ---
`range` | The type of the column’s value. See RANGE for details.

### 7.3.42.5.12. `OBJECT` (`"column:index"` object type specific properties)

Here are `"column:index"` object type specific properties in `OBJECT`:

    {
      "sources": SOURCES
    }

Name | Description
--- | ---
`sources` | The sources of the index column. See SOURCES for details.

### 7.3.42.5.13. `SOURCES`

`SOURCES` represents the sources of the index column.

`SOURCES` is an array of `SOURCE`:

    [
      SOURCE_1,
      SOURCE_2,
      ...,
      SOURCE_n
    ]

`SOURCE` has the following properties:

    {
      "id":   ID,
      "NAME": NAME
    }

Name | Description
--- | ---
`id` | The ID of the source table or column. It’s an integer.
`name` | The name of the source table or column. It’s a string.

## 7.3.42.6. See also

> - schema