I have a script updating a MongoDB collection and log the error and result object in its callback function. Every works fine except the result object contains a long chunk of code, which I have no idea how to get rid of. I'm using native MongoDB node.js driver, version 2.0.46.
Code snippet:
var find = {_id:id}, set = {$set:{dt:now}};
myCollection.update(find, set, function(err, result) {
if(err) logger.error(JSON.stringify([find, set]), err.toString());
else logger.verbose(result);
})
I then receive this set of log entry when no error occurs for the update.
2015-10-29T03:45:13.253Z - verbose: ok=1, nModified=1, n=1, _bsontype=Timestamp, low_=17, high_=1446090311, _bsontype=ObjectID, id=V.ßÂb$#\¾¾«, domain=null,
close=function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
The function you see in the log entry above is just a small part. The actual "close function" is tens of thousands lines long, so it fills up my log files quickly.
The logger I'm using is Winston.
I'm wondering what I have done wrong to cause such a return? Any advice is appreciated.