Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cb is not a function #115

Closed
melsayed91 opened this issue Jan 12, 2018 · 2 comments
Closed

cb is not a function #115

melsayed91 opened this issue Jan 12, 2018 · 2 comments

Comments

@melsayed91
Copy link

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
}

@melsayed91
Copy link
Author

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

@Laxmar
Copy link

Laxmar commented Feb 7, 2018

Thanks! I tried use this with typescript and I got missing types error. Solution is changing version to 3.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants