I am using multiple MongoDB connection with debug mode enabled. Is there a way to log the database name in debug log?
Not currently, you would need a custom debug function. Here's a quick proof of concept for printing out the database name and collection name in a custom debug function:
mongoose.set('debug', function(collectionName, op) {
console.log(`${this.conn.name}.${collectionName}.${op}()`);
});
@devme1: there might be other useful arguments that the debug callback gets.
Most helpful comment
Not currently, you would need a custom debug function. Here's a quick proof of concept for printing out the database name and collection name in a custom debug function: