We are unable to move forward regarding the stored procedures(stored javascripts) concepts. Request you to expalin us how to create and reuse the stored procedures (stored javascripts) in mongoDB with example.
Below is the sample javascript which we have tried:
db.system.js.save({ "_id" : "echo", "value" : function(x){return x;} }) o/p: Updated 1 new record(s) in 3ms
When we are passing a command below is the output:
db.getCollection("system.js").find({}) o/p: _id : echo
but we are unable to understand how to reuse it.
db.loadServerScripts() o/p: Script executed successfully, but there is no result to show.
Appreciate your response.