mongo时间序列收集中的bucket和聚合中的bucket stage有区别吗?

发布于 2025-01-17 13:42:58 字数 340 浏览 1 评论 0原文

我很困惑。我的目标是根据时间范围从我的集合中获取数据,例如一天、一周和一个月的数据。

我发现几乎没有用于创建时间序列集合的实现,我可以在其中存储本文中描述的数据。

时间序列集合

{  “timeField”:创建时间, “元字段”:交互类型, “秒后过期”:2592000 } interaction_type:评论或喜欢或查看

所以我想检索过去24小时、过去7天、过去30天每种互动类型的计数。

我已经从理论上弄清楚了,如果有人能帮忙,请告诉我。

我尝试创建时间序列集合并插入大约一百万个文档。

我根本不知道如何继续。

I am confused. My aim is to get data from my collection based on time ranges like data in a day, week and month.

I found almost no implementation for creating a time series collection where I can bucket data liek described in this post.

Time Series Collection

{
 "timeField": created_at,
"metaField": interaction_type,
"expireAfterSeconds": 2592000
}
interaction_type: comment OR like OR view

So I want to retrieve count of each interaction type in last 24 hours, last 7 days, last 30 days.

I have it figured out theoretically, if any of you can help please let me know.

I tried creating the time series collection and inserted around a million documents.

I cannot figure out how to proceed at all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文