mongo时间序列收集中的bucket和聚合中的bucket stage有区别吗?
我很困惑。我的目标是根据时间范围从我的集合中获取数据,例如一天、一周和一个月的数据。
我发现几乎没有用于创建时间序列集合的实现,我可以在其中存储本文中描述的数据。
时间序列集合
{ “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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论