Docs HomeNode.js

Time Series时间序列

Overview概述

In this guide, you can learn about time series collections in the MongoDB Node.js driver.在本指南中,您可以了解MongoDB Node.js驱动程序中的时间序列集合。

Create a Time Series Collection创建时间序列集合

We recommend that you create a time series collection using the MongoDB Shell. 我们建议您使用MongoDB Shell创建一个时间序列集合。Learn more about how to install and run the MongoDB Shell in the MongoDB Shell documentation. MongoDB Shell文档中了解有关如何安装和运行MongoDB Shell的更多信息。For detailed instructions on creating a time series collection using the MongoDB Shell, see our MongoDB Manual entry on time series collections.有关使用MongoDB Shell创建时间序列集合的详细说明,请参阅MongoDB手册关于时间序列集合

Query a Time Series Collection查询时间序列集合

Since you query a time series collection in the same way you query other collection types in MongoDB, the Node.js driver has no features specifically for querying time series data.由于查询时间序列集合的方式与查询MongoDB中其他集合类型的方式相同,因此Node.js驱动程序没有专门用于查询时间序列数据的功能。

For more information on querying data in the MongoDB Node.js driver, see the following resources:有关在MongoDB Node.js驱动程序中查询数据的更多信息,请参阅以下资源:

Note

Window Functions窗口函数

MongoDB version 5.0 introduces window functions into the MongoDB aggregation pipeline. MongoDB版本5.0在MongoDB聚合管道中引入了窗口函数。You can use window functions to perform operations on a contiguous span of time series data. 您可以使用窗口函数对连续的时间序列数据执行操作。For more information, see the reference documentation for the $setWindowFields aggregation stage.有关更多信息,请参阅$setWindowFields聚合阶段的参考文档