A newer version of this documentation is available.

View Latest

collections

  • reference
    +
    Provides information on collections.

    Syntax

    cbstats host:11210 [common options] collections
      [ <scope>.<collection> | id <collectionID> ]

    Description

    Displays information on collections.

    Options

    When used without a command-specific option, the collections command returns information on all collections for the specified bucket, on the specified node. If the <scope>.<collection> option is used, the command returns information on the collection so specified. If the id <collectionID> option is used, the command returns information on the collection whose id is passed as the <collectionID> argument.

    For common cbstats options, see cbstats.

    Examples

    The following command retrieves all collections-related information for the bucket travel-sample, on the specified node:

    /opt/couchbase/bin/cbstats localhost:11210 \
    -u Administrator -p password \
    -b travel-sample collections

    The output is as follows:

    0x0:0x0:collections_mem_used:  22137956
    0x0:0x0:data_size:             2161511
    0x0:0x0:history:               false
    0x0:0x0:items:                 3273
    0x0:0x0:name:                  _default
    0x0:0x0:ops_delete:            0
    0x0:0x0:ops_get:               0
    0x0:0x0:ops_store:             31591
    0x0:0x0:scope_name:            _default
    0x8:0x8:collections_mem_used:  0
    0x8:0x8:data_size:             18020
    0x8:0x8:history:               false
    0x8:0x8:items:                 0
    0x8:0x8:name:                  bookings
    0x8:0x8:ops_delete:            0
    0x8:0x8:ops_get:               0
    0x8:0x8:ops_store:             0
    0x8:0x8:scope_name:            tenant_agent_04
    0x8:0x9:collections_mem_used:  23877
    0x8:0x9:data_size:             19954
    0x8:0x9:history:               false
    0x8:0x9:items:                 4
    0x8:0x9:name:                  users
    0x8:0x9:ops_delete:            0
    0x8:0x9:ops_get:               0
    0x8:0x9:ops_store:             40
    0x8:0x9:scope_name:            tenant_agent_04
    0x9:0xa:collections_mem_used:  0
    0x9:0xa:data_size:             18444
    0x9:0xa:history:               false
    0x9:0xa:items:                 0
    0x9:0xa:name:                  bookings
    0x9:0xa:ops_delete:            0
    0x9:0xa:ops_get:               0
    0x9:0xa:ops_store:             0
    0x9:0xa:scope_name:            tenant_agent_03
    0x9:0xb:collections_mem_used:  19566
    0x9:0xb:data_size:             19755
    0x9:0xb:history:               false
    0x9:0xb:items:                 3
    0x9:0xb:name:                  users
    0x9:0xb:ops_delete:            0
    0x9:0xb:ops_get:               0
    0x9:0xb:ops_store:             33
    0x9:0xb:scope_name:            tenant_agent_03
    0xa:0xc:collections_mem_used:  0
    0xa:0xc:data_size:             18444
    0xa:0xc:history:               false
    0xa:0xc:items:                 0
    0xa:0xc:name:                  bookings
    0xa:0xc:ops_delete:            0
    0xa:0xc:ops_get:               0
    0xa:0xc:ops_store:             0
    0xa:0xc:scope_name:            tenant_agent_02
    0xa:0xd:collections_mem_used:  11714
    0xa:0xd:data_size:             18514
    0xa:0xd:history:               false
    0xa:0xd:items:                 1
    0xa:0xd:name:                  users
    0xa:0xd:ops_delete:            0
    0xa:0xd:ops_get:               0
    0xa:0xd:ops_store:             20
    0xa:0xd:scope_name:            tenant_agent_02
    0xb:0xe:collections_mem_used:  0
    0xb:0xe:data_size:             18444
    0xb:0xe:history:               false
    0xb:0xe:items:                 0
    0xb:0xe:name:                  bookings
    0xb:0xe:ops_delete:            0
    0xb:0xe:ops_get:               0
    0xb:0xe:ops_store:             0
    0xb:0xe:scope_name:            tenant_agent_01
    0xb:0xf:collections_mem_used:  6464
    0xb:0xf:data_size:             18547
    0xb:0xf:history:               false
    0xb:0xf:items:                 1
    0xb:0xf:name:                  users
    0xb:0xf:ops_delete:            0
    0xb:0xf:ops_get:               0
    0xb:0xf:ops_store:             11
    0xb:0xf:scope_name:            tenant_agent_01
    0xc:0x10:collections_mem_used: 0
    0xc:0x10:data_size:            18020
    0xc:0x10:history:              false
    0xc:0x10:items:                0
    0xc:0x10:name:                 bookings
    0xc:0x10:ops_delete:           0
    0xc:0x10:ops_get:              0
    0xc:0x10:ops_store:            0
    0xc:0x10:scope_name:           tenant_agent_00
    0xc:0x11:collections_mem_used: 1195
    0xc:0x11:data_size:            18020
    0xc:0x11:history:              false
    0xc:0x11:items:                0
    0xc:0x11:name:                 users
    0xc:0x11:ops_delete:           0
    0xc:0x11:ops_get:              0
    0xc:0x11:ops_store:            2
    0xc:0x11:scope_name:           tenant_agent_00
    0xd:0x12:collections_mem_used: 14059183
    0xd:0x12:data_size:            1406085
    0xd:0x12:history:              false
    0xd:0x12:items:                2510
    0xd:0x12:name:                 route
    0xd:0x12:ops_delete:           0
    0xd:0x12:ops_get:              0
    0xd:0x12:ops_store:            24024
    0xd:0x12:scope_name:           inventory
    0xd:0x13:collections_mem_used: 36555
    0xd:0x13:data_size:            20716
    0xd:0x13:history:              false
    0xd:0x13:items:                17
    0xd:0x13:name:                 airline
    0xd:0x13:ops_delete:           0
    0xd:0x13:ops_get:              0
    0xd:0x13:ops_store:            187
    0xd:0x13:scope_name:           inventory
    0xd:0x14:collections_mem_used: 547359
    0xd:0x14:data_size:            66544
    0xd:0x14:history:              false
    0xd:0x14:items:                206
    0xd:0x14:name:                 airport
    0xd:0x14:ops_delete:           0
    0xd:0x14:ops_get:              0
    0xd:0x14:ops_store:            1968
    0xd:0x14:scope_name:           inventory
    0xd:0x15:collections_mem_used: 4047924
    0xd:0x15:data_size:            436970
    0xd:0x15:history:              false
    0xd:0x15:items:                96
    0xd:0x15:name:                 hotel
    0xd:0x15:ops_delete:           0
    0xd:0x15:ops_get:              0
    0xd:0x15:ops_store:            917
    0xd:0x15:scope_name:           inventory
    0xd:0x16:collections_mem_used: 3446935
    0xd:0x16:data_size:            334754
    0xd:0x16:history:              false
    0xd:0x16:items:                463
    0xd:0x16:name:                 landmark
    0xd:0x16:ops_delete:           0
    0xd:0x16:ops_get:              0
    0xd:0x16:ops_store:            4495
    0xd:0x16:scope_name:           inventory
    manifest_uid:                  1

    Each line of the output presents a data key. Each key is of the format scopeID : collectionID : datumLabel. Each scopeID or collectionID is a hexadecimal number, prefixed by 0x. Each datumLabel is a string. Each data key is concluded with a colon, and the associated value is presented to the right of the colon.

    Within the output, each successive group of lines presents information on one of the collections for the specified bucket, on the specified node.

    The first collection is identified, on each of the first nine lines, as 0x0:0x0; and, on line five, as the _default collection.

    Line one displays, in bytes, the total memory (across active vBuckets) used by this collection (here, 22137956). Line two displays the total disk space occupied (across active vBuckets) by this collection for the specified bucket, on the specified node: this total (here, 2161511) is, again, expressed in bytes.

    Line three indicates whether a change history is made for the collection: true indicates that a change history is being made, and false indicates that it is not. (Note that the value can only be true when Magma has been configured as the storage engine for the bucket: see Creating and Editing Buckets.)

    Line four displays the number of items within the collection, across active vBuckets (here, 3273).

    Lines six to eight display the numbers of deletions, gets, and writes for documents within this collection (which are 0, 0, and 31591, respectively). The eighth line identifies the scope within which this collection resides: in this case, the scope is the _default scope.

    Subsequent lines describe other scopes and collections within travel-sample.

    The manifest_uid value (here, 1) is associated with the current state of collections on the node; and will be incremented whenever a collections-related change is made.

    The following command returns information on a collection specified by means of the <scope>.<collection> option:

    /opt/couchbase/bin/cbstats 127.0.0.1:11210 \
    -u Administrator -p password \
    -b travel-sample collections inventory.airline

    The output is as follows:

    0xd:0x13:collections_mem_used: 36012
    0xd:0x13:data_size:            126471
    0xd:0x13:items:                187
    0xd:0x13:name:                 airline
    0xd:0x13:ops_delete:           0
    0xd:0x13:ops_get:              0
    0xd:0x13:ops_store:            0
    0xd:0x13:scope_name:           inventory

    The output, for the airline collection, within the inventory scope, is thus a subset of that which was returned above, for all collections.

    The following command returns information on the same collection, specified by means of the id <collectionID> option:

    /opt/couchbase/bin/cbstats 127.0.0.1:11210 \
    -u Administrator -p password \
    -b travel-sample collections id 0x13

    The id here specified, 0x13, was previously identified, in the output for all collections, as that for airline. The output is again as follows:

    0xd:0x13:collections_mem_used: 36012
    0xd:0x13:data_size:            126471
    0xd:0x13:items:                187
    0xd:0x13:name:                 airline
    0xd:0x13:ops_delete:           0
    0xd:0x13:ops_get:              0
    0xd:0x13:ops_store:            0
    0xd:0x13:scope_name:           inventory

    See Also

    For an overview of scopes and collections, see Scopes and Collections.

    For a step-by-step explanation of creating scopes and collections with the CLI, see Manage Scopes and Collections with the CLI. For a comparable explanation with the REST API, see Manage Scopes and Collections with the REST API.

    To use cbstats to provide further details on collections, see the reference page for the collections-details command.