PromiseLibrary deprecation warning

Hello, I’m using mongodb node.js driver version 4.1.2 and I want to specify bluebird as a promise library so I add this to my options object : promiseLibrary: require('bluebird')

Then I get this warning : [MONGODB DRIVER] Warning: promiseLibrary is a deprecated option

However, promiseLibrary seems to be a valid option according to the doc MongoOptions | mongodb

Am I missing something ? What is the default value if I don’t use the promiseLibrary option ?

Hi @Raphael, the option still works as you would expect, it takes a custom Promise constructor to use for creating promises within the driver.

Here’s an example:

const BluebirdPromise = require('bluebird').Promise;
new MongoClient('mongodb://...', { promiseLibrary: BluebirdPromise });

The warning is letting you know that the option is marked as deprecated since we do plan on removing this option in the next major version. But it is still working and tested in the current major release.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.