I have a problem executing stored function on MongoDB from my java code , i have a stored function like this.
db.system.js.save({
_id:"myFunction",
value:function(data){
//todo
return 1 + 1;
}
});
And in my java code :
mongoClient = new MongoClient(SERVER, PORT); // should use this always
db = mongoClient.getDB(DB);
DBObject datos = new BasicDBObject();
datos.put("val", "myvalue");
Then i am trying to execute the function:
try 1
db.doEval("myFunction", datos);
try 2
db.eval("myFunction", datos);
try 3
DBObject query = new BasicDBObject();
query.put("myFunction", datos);
db.command(query);
But the stored function does not execute, any ideas ?