我是mongodb(java)的新手.
I am newbie to mongodb (java).
我需要通过使用与关系数据库中的过程类似的命令来执行命令列表(关系中的查询).
I need to execute list of commands(queries in relational) by using something similar to procedures in relational db.
在mongodb中可以吗?
Is it possible in mongodb?
推荐答案MongoDB没有真正意义上的存储过程.它具有服务器端功能,但是这些功能如下:
MongoDB has no real sense of stored procedures. It has server side functions however these functions:
- 不支持分片
- 很慢
- 必须逃避(邪恶博士)
- 仅真正设计用于Map Reduces中,以使您不必在多个地方存放通用代码的多份副本.
但是,您可以通过$where或eval在system.js中使用实际的函数名称来实现.但是,这些实际上并没有在服务器端"运行.
However you can achieve it with $where or evaling an actual function name within system.js. But then these actually don't run "server-side".
在您的应用程序中使用exec type命令来调用Shell也不是一个好主意.您在Shell中运行的脚本文件与您自己的应用程序一样具有客户端功能,因此毫无意义.
Using a exec type command in your app to call the shell won't be a good idea either. The script files you run in shell are as much client side as your own app so that's just pointless.
MongoDB也不允许触发器,但是触发器在JIRA中: jira.mongodb /browse/SERVER-124 ,但未计划.您需要在代码中将触发器放置在客户端.
MongoDB also does not allow triggers however they are within the JIRA: jira.mongodb/browse/SERVER-124 but are not scheduled. You will need to place triggers on client side within your coding.
关系查询
NoSQL不是关系的.您可能想了解如何为MongoDB设计合适的架构,这是一个起点: www.mongodb/display/DOCS/Schema+Design .这将教您MongoDB的本质以及如何选择正确的结构.
NoSQL is not relational. You might want to read up on how to design a proper schema for MongoDB, here is a starting point: www.mongodb/display/DOCS/Schema+Design. This will teach you the essence of MongoDB and how to choose the right structure.
更多推荐
mongodb中是否存在过程
发布评论