Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by Przemek eS for db.collection is not a function

Uninstalling existing mongodb package and reinstalling using the following commands resolved the issues

npm uninstall mongodb --savenpm install mongodb@2.2.33 --save 

Version MongoDB >= 3 - That database variable is actually the parent object of the object you are trying to access. If u using mongo 3+:

const myDb = db.db('YourDatabase') myDb.collection('YourDatabase).insertOne .... 

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>