Question

i use node.js and node-mongodb-native driver, with connection pooling. is there any way to enable debug for see what's happening, how many connections are active and when a connection is opened or closed?

i would like to see something like:

* connection xxx opened on host:port
* connection yyy opened on host:port
* connection xxx closed
Was it helpful?

Solution

The Db() and Server() objects both support a logger option, which is an object with log, error and debug functions. The Db() option doesn't appear to be documented at the moment, but it is mentioned in the 0.9.6-20 2011-10-04 changelog entry.

I'm not sure if all of the information you need is supported with this interface, but it's definitely a good place to start. The driver team would also probably welcome a pull request to add such features.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top