You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here is my configuration var winston = require('winston') var MongoDB = require('winston-mongodb').MongoDB; winston = new winston.Logger({ transports: [ new MongoDB({ "collection": "log", "db": "mongodb://username:password@localhost:27017/myDb?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin", "name": "error-mongo", "handleExceptions": true }) ] }); winston.log('info','infoTest',{ error: "testError" })
and I'm getting the following error
TypeError: cb is not a function
at logDb.collection.insertOne.then (c:\node_modules\winston-mongodb\lib\winston-mongodb.js:202:7)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
I think the problem was in my version, when I installed the package I found it installed with version 4.0.0 rc1, but the master branch has a different version which is 3.0.0 after installing this version it's worked correctly
I'm trying to use winston-mongodb in my project
here is my configuration
var winston = require('winston') var MongoDB = require('winston-mongodb').MongoDB; winston = new winston.Logger({ transports: [ new MongoDB({ "collection": "log", "db": "mongodb://username:password@localhost:27017/myDb?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin", "name": "error-mongo", "handleExceptions": true }) ] }); winston.log('info','infoTest',{ error: "testError" })
and I'm getting the following error
TypeError: cb is not a function
at logDb.collection.insertOne.then (c:\node_modules\winston-mongodb\lib\winston-mongodb.js:202:7)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
and the object inserted in the db is
{
"_id" : ObjectId("5a58e2ae34cbef3cf8ac9a9d"),
"timestamp" : ISODate("2018-01-12T16:30:38.883+0000"),
"level" : null,
"message" : "undefined",
"meta" : null
}
The text was updated successfully, but these errors were encountered: