Advanced Node and Express - Registration of New Users db.collection is not a function

Im trying to pass this challenge and been reading other threads with other troubles, which I also have, but in my case I when I try to use the app or try to validate the challenge in FFC I get this message on Glitch “db.collection is not a function”. I’ve been able to pass the next two challeges after this one but don’t want to continue without being able to use app. Herer is a link to my project.

You are using mongodb v3.1.11.

In version 2.x you would get the database object as an argument to the connect callback

MongoClient.connect('mongodb://localhost:27017/mytestingdb', (err, db) => {
  // Database returned
});

According to the changelog for 3.0 you now get a client object containing the database object instead:

MongoClient.connect('mongodb://localhost:27017', (err, client) => {
  // Client returned
  var db = client.db('mytestingdb');
});
2 Likes

It worked! Thank you.

Now I have to figure out the other troubles.