db.collection is not a function when using MongoClient v3.0

I encountered the same thing. In package.json, change mongodb line to “mongodb”: “^2.2.33”. You will need to uninstall mongodb npm by removing MongoDB Driver/ node_modules or etc , then install npm to install this version.

This resolved the issue for me. Seems to be a bug or docs need to be updated.

Leave a Comment