Interface Cluster

interface Cluster {
    nodes: (<O>(opts?) => Promise<Node<O>[]>);
    queryShardingState: ((collection, opts?) => Promise<{
        collection: string;
        shards: {
            replicas: string[];
            shard: string;
        }[];
    }>);
    replicate: ((args) => Promise<string>);
    replications: Replications;
}

Properties

nodes: (<O>(opts?) => Promise<Node<O>[]>)

Get the status of all nodes in the cluster.

Type declaration

    • <O>(opts?): Promise<Node<O>[]>
    • Type Parameters

      Parameters

      Returns Promise<Node<O>[]>

Returns

The status of all nodes in the cluster.

queryShardingState: ((collection, opts?) => Promise<{
    collection: string;
    shards: {
        replicas: string[];
        shard: string;
    }[];
}>)

Query the sharding state of a specific collection.

Type declaration

    • (collection, opts?): Promise<{
          collection: string;
          shards: {
              replicas: string[];
              shard: string;
          }[];
      }>
    • Parameters

      Returns Promise<{
          collection: string;
          shards: {
              replicas: string[];
              shard: string;
          }[];
      }>

Returns

The sharding state of the collection.

replicate: ((args) => Promise<string>)

Replicate a shard from one node to another.

Type declaration

    • (args): Promise<string>
    • Parameters

      Returns Promise<string>

Returns

The ID of the replication request.

replications: Replications

Access replication operations.