如何使用 MongoDB 进行报告?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14282817/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to do reporting with MongoDB?
提问by mpen
I'm considering MongoDB for my next big project, but I have a couple of concerns. In particular, how can I do reporting?
我正在考虑将 MongoDB 用于我的下一个大项目,但我有一些担忧。特别是,我如何进行报告?
My understanding is that I can't do the same kinds of joins and aggregation I would normally do in a relational database. The reporting I had in mind involves aggregating a lot of data from different "tables" with strict criteria.
我的理解是,我无法执行通常在关系数据库中执行的相同类型的连接和聚合。我想到的报告涉及以严格的标准从不同的“表”中聚合大量数据。
Is this easily doable in MongoDB, or is it going to be a big headache?
这在 MongoDB 中容易实现吗,还是会很头疼?
回答by John A. De Goes
While Pentaho and Jaspersoft and other legacy reporting solutions have ways to pump data out of MongoDB, there are two newer solutions designed explicitly for analytics and reporting on MongoDB data:
虽然 Pentaho 和 Jaspersoft 以及其他传统报告解决方案可以将数据从 MongoDB 中抽取出来,但有两个较新的解决方案专门设计用于对 MongoDB 数据进行分析和报告:
- JSON Studio. This is a commercial solution that lets you visually build aggregation pipelines and connect them to charts.
- SlamData. This is an open source solution that lets you run SQL queries directly on MongoDB (including JOINs, GROUP BY, HAVING, etc), through the GUI interface or an API. The current version of the project has data visualization baked in, and allows you to create and embed reporting dash boards into MongoDB applications.
- JSON 工作室。这是一个商业解决方案,可让您直观地构建聚合管道并将它们连接到图表。
- 大满贯数据。这是一个开源解决方案,可让您通过 GUI 界面或 API 直接在 MongoDB 上运行 SQL 查询(包括 JOIN、GROUP BY、HAVING 等)。该项目的当前版本具有数据可视化功能,并允许您创建报告仪表板并将其嵌入到 MongoDB 应用程序中。
Because both of these run on top of MongoDB (versus the other approach, i.e. pumping the data out and normalizing it for reporting in Mondrian or something), they are much easier and more natural for MongoDB reporting. The flip side is that because the data is not loaded into all-memory cubes (for example), the reporting experience can suffer if you try to do complicated report generation in real-time.
因为这两种方法都运行在 MongoDB 之上(相对于另一种方法,即抽取数据并将其规范化以使用 Mondrian 或其他方式进行报告),对于 MongoDB 报告而言,它们更容易、更自然。另一方面是因为数据没有加载到全内存多维数据集中(例如),如果您尝试实时生成复杂的报告,报告体验可能会受到影响。
Disclaimer: I'm a contributor for the SlamData project, although I have no affiliation with JSON Studio.
免责声明:我是 SlamData 项目的贡献者,尽管我与 JSON Studio 没有任何关系。
回答by Miguel Garcia
It seems that the open source tools like JasperReports and Pentaho can connect to MongoDB, also if you want to jump to the NoSQL ship but without jumping to the NoSQL ship, you may use an ODBC or OLE DB driver like Simba's one, and then use any normal SQL reporting tool like DBxtra
好像JasperReports和Pentaho等开源工具可以连接MongoDB,同样如果你想跳到NoSQL船但不跳到NoSQL船,你可以使用像Simba这样的ODBC或OLE DB驱动程序,然后使用任何普通的 SQL 报告工具,如DBxtra
回答by Zarathustra
In general do not use mongodb just because you wanna try something new in a production environment: that is what will bring you a lot of headaches. There is a great Stackoverflow post about when to use it: https://stackoverflow.com/a/1477354/1248724
一般来说,不要仅仅因为你想在生产环境中尝试新的东西而使用 mongodb:这会给你带来很多麻烦。关于何时使用它有一个很棒的 Stackoverflow 帖子:https: //stackoverflow.com/a/1477354/1248724
Regarding reporting: Map-Reduce, especially incremental one will help you a lot, but you can't treat mongoDB as a relational database. It just isn't one. For example the Query for a subdocument madness. The mongoDB Aggregation-Frameworkwill do well in most cases but has its limits compared to SQL.
关于报告: Map-Reduce,尤其是增量的会帮助你很多,但你不能把 mongoDB 当作关系数据库。它只是不是一个。例如对子文档疯狂的查询。mongoDB Aggregation-Framework在大多数情况下表现良好,但与 SQL 相比有其局限性。
回答by Eugene Bosikov
If you are using .NET, easy to write reports using DexExpress reports. It works well with MongoDb .NET driver, only one limitation, you have to have strong types for each aggregation that you are using in your data. All types you can use from your main application db provider, so it will not be a big headache. If your MongoDB collections are similar to SQL data tables, you can use ODBC drivers, this way is very limited but you can use any reporting services that works with ODBC connection. I prefer to use first: "DevExpress" XtraReports.
如果您使用 .NET,使用 DexExpress 报告轻松编写报告。它适用于 MongoDb .NET 驱动程序,只有一个限制,您必须为您在数据中使用的每个聚合提供强类型。您可以从主应用程序 db 提供程序使用的所有类型,因此不会令人头疼。如果您的 MongoDB 集合类似于 SQL 数据表,您可以使用 ODBC 驱动程序,这种方式非常有限,但您可以使用任何与 ODBC 连接一起工作的报告服务。我更喜欢先使用:“DevExpress”XtraReports。
回答by Bon
MongoDB reporting is made easier because it has the aggregation framework which provides an api that can be connected to a reporting software. Here is an article that provides details on MongoDB reporting and visualization http://blog.jinfonet.com/mongodb-reporting-visualization-jreport/
MongoDB 报告变得更容易,因为它具有聚合框架,该框架提供了可以连接到报告软件的 api。这是一篇提供有关 MongoDB 报告和可视化的详细信息的文章http://blog.jinfonet.com/mongodb-reporting-visualization-jreport/
回答by Marc Polizzi
Not sure you can do in MongoDB all your reporting plus have sufficient response time. So you could add a tool on top of MongoDB for that purpose. E.g., icCubeis now supporting MongoDBfor this kind of usage. It makes no sense to extract the whole set of data but most of the time data for the reporting and analytics represent only a fraction of the whole and it makes sense to connect an in-memory OLAP tool for reporting and analytics.
不确定您是否可以在 MongoDB 中完成所有报告以及是否有足够的响应时间。因此,您可以为此在 MongoDB 之上添加一个工具。例如,icCube现在支持MongoDB用于这种用途。提取整个数据集是没有意义的,但大部分时间用于报告和分析的数据仅代表整体的一小部分,连接内存中的 OLAP 工具进行报告和分析是有意义的。
回答by Dan
as far as I know there is no easy way to perform joins, aggregations, etc. the same way you would in a relational database in Mongo. There are different external analytics tools you can use for this. At my company we use Sisenseand connect it to MongoDB via an ODBC driver, which lets us use SQL-like functionality on our data and it works great. However, I do not know of a way to do this natively in MongoDB.
据我所知,没有简单的方法可以像在 Mongo 中的关系数据库中那样执行连接、聚合等。您可以使用不同的外部分析工具。在我的公司,我们使用Sisense并通过 ODBC 驱动程序将其连接到 MongoDB,这让我们可以在我们的数据上使用类似 SQL 的功能,并且效果很好。但是,我不知道在 MongoDB 中以本机方式执行此操作的方法。