Adding User on fresh MongoDB > 4.0 instances broken
The Problem occurs when connecting to a fresh instance of MongoDB version > 4.0: MongoDB version > 4.0 requires server-side password digestion by default, which ist not supported by addUser in the 2.2 branch of the mongodb driver. The node-mongo-native team rejects commits to the 2.2 branch to fix this problem - see: https://github.com/mongodb/node-mongodb-native/pull/1852 - it as to be solved elswhere in consequence. Options are upgrading to a newer mongodb driver, greater v3.0.11 (first version supporting automatic digestion handling in addUser https://github.com/mongodb/node-mongodb-native/commit/1df6ab0) or for the time being i have attached a diff-patch (as .txt due to file-type restrictions) for patching v2.2.x drivers /lib/db.js to support automatic digestion handling: dbjs_path_base2_2_36.txt (tested and working for 2.2.x releases). Possible option to circumvent this is of course using the 2.2 branch from the repository I filed the pull request with https://github.com/bitmeal/node-mongodb-native/tree/2.2 as the mongodb module in package.json.
The Problem does not occur when you are using a (even fresh) MongoDB instance on a system that had a previous version of MongoDB (<4.0) installed. The previous install does not require user added data (DBs, tables, actual documents created users) but only a fresh install and uninstall.
Referencing #219 for completeness, as I did not see it when posting. This issue (here) goes into more detail describing the underlying error.
For those who need it (probably future me), this is the replaced line in the package.json. (It should be somewhat obvious what it replaces.)
"mongodb": "bitmeal/node-mongodb-native#2.2",