MongoDB供BI使用 [英] MongoDB for BI use

查看:145
本文介绍了MongoDB供BI使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我们希望使用MongoDB进行某些BI处理,我们不知道哪种模式更适合我们的情况来完成工作。想象一下,我们有10万个描述某个网络销售的数据,我们是否必须将所有这些数据放在一个数组中? (像这样)

Actually we want to use MongoDB for some BI processing and we don't know which schema is more suited in our case to get the job done. Imagine we got 100 000 data describing sales of a certain network, do we have to put all this data in one array? (like this)

{
   "_id" : ObjectId()
   "dataset" : "set1",
   "values" : [
                  {"property":"value_1"},
                     .
                     .
                     .
                     .
                  {"property":"value_100000"}
              ]
}

还是每个条目一个文件? (像这样)

Or for each entry a document? (like this)

{"_id: ObjectId(), "property":"value_1"}
                     .
                     .
                     .
{"_id: ObjectId(), "property":"value_100000"}

或者只是计划此用例的理想方法是什么?

Or simply what is the ideal way to scheme this use case?

推荐答案

嵌入更适合:


  • 小子文档

  • 数据不会定期更改

  • 最终一致性是可以接受的

  • 少量增长的文档

  • 您通常需要执行第二次查询才能获取的数据

  • 快速阅读速度

  • Small subdocuments
  • Data that does not change regularly
  • WHen eventual consistency is acceptable
  • Document that grow by a small amount
  • Data that you'll often need to perform asecond query to fetch
  • Fast reading speed

参考文献更好


  • 大子文档

  • 易失数据

  • 需要立即进行紧急情况

  • 文档大量增长

  • 您经常从文档中排除的数据

  • 快速命令速度

  • Large subdocuments
  • Volatile data
  • When immediate consitency is necessary
  • Document grow with a large amount
  • Data that you often exclude from document
  • Fast write speed

-摘自《 Mongodb权威指南》

-From 《Mongodb Definitive Guide》

参考像
{'_id':ObjectId( 123),'cousin':ObjectId( 456)}
一样,它的表亲通过ObjectId来引用它,就像SQL中的外键一样。

Reference is something like {'_id':ObjectId("123"),'cousin':ObjectId("456")} It refers to his cousin through its ObjectId something like foreign key in SQL.

这篇关于MongoDB供BI使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆