AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

listShards(データベースコマンド)

listShards

The listShards command returns a list of the configured shards in a sharded cluster. listShards is only available on mongos instances and must be issued against the admin database.

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のための完全管理サービスです
  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

このコマンドの構文は、次のとおりです。

db.runCommand(
{
listShards: 1
}
)

The following operation runs listShards against the mongos admin database:

db.adminCommand({ listShards: 1 })

The following document is an example of the output from a listShards command:

{
"shards": [
{
"_id": "shard01",
"host": "shard01/host1:27018,host2:27018,host3:27018",
"state": 1
},
{
"_id": "shard02",
"host": "shard02/host4:27018,host5:27018,host6:27018",
"tags": [ "NYC" ],
"state": 1
},
{
"_id": "shard03",
"host": "shard03/host7:27018,host8:27018,host9:27018",
"state": 1
}
],
"ok": 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1510716515, 1),
"signature" : {
"hash" : BinData(0,"B2ViX7XLzFLS5Fl9XEuFXbwKIM4="),
"keyId" : Long("6488045157173166092")
}
},
"operationTime" : Timestamp(1510716515, 1)
}

listShards は、次の内容を含むドキュメントを返します。

このページを評価