For security reasons, everyone should know that the only time you can manipulate the results of your query is DEPENDENCE ... therefore you should not bind it to var in order to cheat later, only in the callback) - =.
, . .:
var results_not_ugly_or_messed_up = (JSON.stringify(result));
, perl/python/sh/bat/whatever script "" ( , results_not_ugly_or_messed_up) , .., , , .
:
db.newguestbook.find({"Name" : /[Aa]/ },[],function(err,p) //newguestbook is a collection I have
//you will need to change that unless you make a collection called newguestbook
{
cursor = p;
console.log(cursor);
console.log(JSON.stringify(cursor)));
var exec = require('child_process').exec;
exec("perl writetofile.pl " + JSON.stringify(cursor) , function(err,
stdout, stderr)
{
console.log("Perl run to store this result in a file");
});
});
}