I am running the following command and I want to see the output in my out.log file but it is not printing anything.
/tmp/mongodb/bin/mongo mydatabase_name /tmp/mongodb/scripts/test.js >> out.log
These are the contents in my test.js
db.system.js.save (
{ _id:"run_job",
value: function() {
console.log("in function");
print("in function>>");
db.myUser.find().forEach(
function(eachuser){
console.log("eachuser id" + eachuser._id);
var lower_id = eachuser._id.toLowerCase();
console.log("Lowercase id" + lower_id);
});
}
}
);
It give error : invoke failed: JS error : console is not defined. So it removed the console.log. But it still does not print using the print function. Thanks.