Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

1. There is a special system collection named system.js.

2. Storeed JavaScript functions can be reuse.


3. To store a function, you can use the db.collection.save()
db.system.js.save(
{
_id : "addNum" ,
value : function (x, y){ return x + y; }
}
);
4. Javascripts
db.loadServerScripts();
5. call javascript
addNum(17, 25)

You might also like