I have implemented a JavaScript function inside the Mongodb server using this example.
It works fine when I use mongo shell, but I want to run it from inside a Java program. This is the code:
public String runFunction() {
CommandResult commandResult1 = db.command("db.loadServerScripts()");
CommandResult commandResult2 = db.command("echoFunction(3)");
return commandResult2.toString();
}
I don't understand the result.
**{ "ok" : 0.0 , "errmsg" : "no such cmd: echoFunction(3)" , "code" : 59 , "bad cmd" : { "echoFunction(3)" : true}}** – Tharanga Apr 18 '15 at 01:52