0

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.

1 Answers1

0

Below is the output if we are using echo() function:

{ "message" : "echo is not defined", "stack" : "script:1:1" }