You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何查看MongoDB中时间序列数据的原始存储桶结构

查看MongoDB时间序列集合的原始存储桶

MongoDB时间序列集合的存储桶默认是隐藏的系统集合,你可以通过以下方式直接查看原始存储桶数据:

  • 确定存储桶集合名称:MongoDB会自动创建名为 system.buckets.<你的时间序列集合名> 的系统集合,你这里对应的就是 system.buckets.weather。
  • 使用常规查询命令查看存储桶:
    // 查看所有存储桶
    db.getCollection("system.buckets.weather").find()
    
    // 过滤特定时间范围的存储桶
    db.getCollection("system.buckets.weather").find({
      "control.min.timestamp": { $gte: ISODate("2024-01-01T00:00:00Z") },
      "control.max.timestamp": { $lte: ISODate("2024-01-02T00:00:00Z") }
    })
    
  • 存储桶核心结构说明:
    • _id: 存储桶的唯一标识
    • control: 包含存储桶的时间范围(min.timestamp/max.timestamp)、元数据哈希、粒度配置等信息
    • data: 以数组形式存储对应时间段内聚合的所有时间序列字段值

内容的提问来源于stack exchange,提问作者shubham

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 23:55:22