appmetrics icon indicating copy to clipboard operation
appmetrics copied to clipboard

Mongo probe doesn't support promise interface

Open smeijer opened this issue 5 years ago • 1 comments

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' });

smeijer avatar Dec 06 '19 12:12 smeijer

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

AbhishekPathania avatar Jul 02 '21 18:07 AbhishekPathania