mongodb中是否存在过程 [英] is procedure exist in mongodb

查看:59
本文介绍了mongodb中是否存在过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是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中,以使您不必在多个地方存放通用代码的多份副本.

但是,您可以通过$whereevalsystem.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中: https://jira.mongodb .org/browse/SERVER-124 ,但未计划.您需要在代码中将触发器放置在客户端.

MongoDB also does not allow triggers however they are within the JIRA: https://jira.mongodb.org/browse/SERVER-124 but are not scheduled. You will need to place triggers on client side within your coding.

关系查询

NoSQL不是关系的.您可能想了解如何为MongoDB设计合适的架构,这是一个起点: http://www.mongodb.org/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: http://www.mongodb.org/display/DOCS/Schema+Design. This will teach you the essence of MongoDB and how to choose the right structure.

这篇关于mongodb中是否存在过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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