Has anyone understood the way to output to the console inside the javascript function that executes the server side in Mongo? Groovy below:
DBCollection js = db.getCollection('system.js') js.save([ '_id' : 'product', value : new Code(""" function(x,y) { alert('product called!'); // blows up... console.log('product called!'); // blows up... return x*y; } """ ) ]) js.eval('product(2,3)')
source share