Unable to Save Logs to mongodb Database for winston-nodejs

I am using the winston library: https://github.com/flatiron/winston Attempting to store data to the mongodb database with: https://github.com/indexzero/winston-mongodb

to insert the data I use:

var MongoDB = require('winston-mongodb').MongoDB;
var logger = new (winston.Logger)({
transports: [
    new (winston.transports.Console)(),
    new (winston.transports.MongoDB)({ host: ip,  db: 'caribcultivate', collection: 'log', level: 'info'})
], exceptionHandlers: [ new winston.transports.Console() ]
});
logger.log('info', "Running logs "+ d);
logger.info("Drive: "+ (new Date(d)).toDateString());

However when I try to query the data using:

winston.query(options, function (err, results) {
    if (err) {console.log(err);}
    console.log(results);
});

I get:

{}

It works for the Console correctly, and I am using the database in other parts of the application with the Mongoose library.

I was having a similar issue. It turned out the problem for me was that the Winston MongoDB transport expects the host option to be just the host name and I was prefixing it with mongodb://.

The following works for me after removing mongodb:// from mongodb://123456.mongolab.com:

var logger = new(winston.Logger)({
    transports : [
        new(winston.transports.MongoDB)({
            db : 'logs',
            host : '123456.mongolab.com',
            username : 'username',
            password : 'password'
        })
    ]
});