Docs Menu
Docs Home
/
MongoDBマニュアル
/ /

データベースでの時系列コレクションの一覧表示

項目一覧

  • 手順
  • 出力

データベース内のコレクションのリストを出力し、コレクション タイプを含むさまざまなプロパティで結果をフィルタリングできます。 この機能を使用して、データベース内のすべての時系列コレクションを一覧表示できます。

データベース内のすべての時系列コレクションを一覧表示するには、 { type: "timeseries" }のフィルターとともに listCollectionsコマンドを使用します。

db.runCommand( {
listCollections: 1,
filter: { type: "timeseries" }
} )

時系列コレクションの場合、出力には次のものが含まれます。

  • type: 'timeseries'

  • options: { timeseries: { ... } }

以下に例を挙げます。

{
cursor: {
id: Long("0"),
ns: 'test.$cmd.listCollections',
firstBatch: [
{
name: 'weather',
type: 'timeseries',
options: {
timeseries: {
timeField: 'timestamp',
metaField: 'metadata',
granularity: 'hours',
bucketMaxSpanSeconds: 2592000
}
},
info: { readOnly: false }
}
]
},
ok: 1
}

戻る

集計と演算子

項目一覧