How can I solve the following error when. when I try to make a connection to mongo I have the following error “TypeError: db.on is not a function”

En el siguiente código:

var mongoose = require('mongoose');

var mongoDB = 'mongodb://localhost/red_bicicletas';
mongoose.connect(mongoDB, {useNewUrlParser: true });
mongoose.Promise = global.Promise;
var db = mongoose.Connection;
db.on('error', console.error.bind(console, 'MongoDB connection error'));

TypeError: db.on is not a function