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.
Is it possible in mongodb?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MongoDB has no real sense of stored procedures. It has server side functions however these functions:
However you can achieve it with
$whereorevaling an actual function name withinsystem.js. But then these actually don’t run “server-side”.Using a
exectype 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 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 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.