RuntimeTools / appmetrics

Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
https://developer.ibm.com/open/node-application-metrics/
Apache License 2.0
975 stars 126 forks source link

Mongo probe doesn't support promise interface #632

Open smeijer opened 4 years ago

smeijer commented 4 years ago

The mongo probe doesn't report anything when using the promise interface:

supported

db.comments.find({ blogId: 'x' }).toArray(console.log);

unsupported

db.comments.find({ blogId: 'x' }).toArray().then(console.log);

Thereby also unsupported

const comments = await db.comments.find({ blogId: 'x' }).toArray();

I use the find method here as an example, but the same is true for the other operations.

const comment = await db.comments.findOne({ id: 'x' });
AbhishekPathania commented 3 years ago

As mongoose thenable are not true promises, this may not work. https://mongoosejs.com/docs/queries.html

Fixed in v14 of Node https://github.com/nodejs/node/issues/22360#issuecomment-653199762