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:data_size:  19827828
    0x0:0x0:items:      31592
    0x0:0x0:mem_used:   21760360
    0x0:0x0:name:       _default
    0x0:0x0:ops_delete: 0
    0x0:0x0:ops_get:    0
    0x0:0x0:ops_store:  1
    0x0:0x0:scope_name: _default
    0x8:0x9:data_size:  68762
    0x8:0x9:items:      2
    0x8:0x9:mem_used:   291
    0x8:0x9:name:       MyCollection
    0x8:0x9:ops_delete: 0
    0x8:0x9:ops_get:    2
    0x8:0x9:ops_store:  2
    0x8:0x9:scope_name: MyScope
    manifest_uid:       4

    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 eight lines, as 0x0:0x0; and, on line four, as the _default collection. Line one of the output displays the total disk space occupied by this collection for the specified bucket, on the specified node: this total (here, 19827828) is expressed in bytes. The second line displays the number of items within the collection (here, 31592). The third line displays, again in bytes, the total memory used by this collection (here, 21760360). Lines five to seven display the numbers of deletions, gets, and writes for documents within this collection (which are 0, 2, and 2, respectively). The eighth line identifies the scope within which this collection resides: in this case, the scope is the _default scope.

    The second collection, identified as 0x8:0x9, is shown to be named MyCollection. It is shown to occupy 68762 bytes of disk space, and 291 bytes of memory. It resides within the scope MyScope, and has so far received zero deletions, two gets, and two writes.

    (Note that the _default collection is indeed provided by default, within the _default scope, for every Couchbase or Ephemeral bucket. The collection MyCollection is one that has been custom-created by the administrator, and does not appear in the sample bucket travel-sample by default.)

    The manifest_uid value (here, 4) 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 MyScope.MyCollection

    The output is as follows:

    0x8:0x9:data_size:  68762
    0x8:0x9:items:      2
    0x8:0x9:mem_used:   291
    0x8:0x9:name:       MyCollection
    0x8:0x9:ops_delete: 0
    0x8:0x9:ops_get:    2
    0x8:0x9:ops_store:  2
    0x8:0x9:scope_name: MyScope

    The output, for MyCollection, 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 0x9

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

    0x8:0x9:data_size:  68762
    0x8:0x9:items:      2
    0x8:0x9:mem_used:   291
    0x8:0x9:name:       MyCollection
    0x8:0x9:ops_delete: 0
    0x8:0x9:ops_get:    2
    0x8:0x9:ops_store:  2
    0x8:0x9:scope_name: MyScope

    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.