List Time Series Collections in a Database列出数据库中的时间序列集合
On this page本页内容
You can output a list of collections in a database and filter the results by a variety of properties, including collection type. You can use this functionality to list all time series collections in a database.您可以输出数据库中的集合列表,并按各种属性(包括集合类型)筛选结果。您可以使用此功能列出数据库中的所有时间序列集合。
Procedure过程
To list all time series collections in a database, use the 要列出数据库中的所有时间序列集合,请将listCollections
command with a filter for { type: "timeseries" }
:listCollections
命令与{ type: "timeseries" }
的筛选器一起使用:
db.runCommand( {
listCollections: 1,
filter: { type: "timeseries" }
} )
Output输出
For time series collections, the output includes:对于时间序列集合,输出包括:
type: 'timeseries'
options: { timeseries: { ... } }
For example:例如:
{
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
}