↧
Answer by Mariana for db.collection is not a function
The reason for this error is the version of the NodeJs Driver. TypeError: db.collection is not a function. If the version is > 3.0.1 then you have to change the db to client. For more info check...
View ArticleAnswer 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...
View ArticleAnswer by edkeveked for db.collection is not a function
you can rewrite your code as followMongoClient.connect(url,(err,db) =>{ const database= db.db('TodoApp') database.collection('Todos').insertOne({})}
View Articledb.collection is not a function
I am trying to simply insert an entry in a MongoDB collection using Nodejs. Here is my code:code:const MongoClient =...
View Article