mongo-in-memory
mongo-in-memory copied to clipboard
Issue with UnhandledPromiseRejectionWarning: Unhandled promise rejection
Could you please update line 160 with
collection.insertOne(document, function (error, result) { if (error) { reject(error); } else if (result.n === 0) { reject(new Error("no document was actually saved in the database")); } else { resolve(result.ops[0]); } });
Also when I run mocha in recursive mode, it's complaining about UnhandledPromiseRejectionWarning: Unhandled promise rejection
. What do you suggest?
@AlirezaAtGeeks could you create a Pull Request for me to approve? How to create a Pull Request tutorial
The unhandled promise rejection I think is something you have to manage in your code either by adding a .catch
or with
process.on('unhandledRejection', error => { console.log('unhandledRejection', error.message); });
Unhandled Promise Rejections in Node.js
It seems I don't have permission to push my changes If you think that is not necessary, I can ignore it. However, I wanted to follow the addDocument procedure for handling it.
Yes it's supposed to be that way. Its a Pull Request not a Push changes! :) Read the tutorial and/or Google it!