Stuck on Advanced Node and Express - Implement the Serialization of a Passport User

Tell us what’s happening:

Successfully connected to DB but cannot pass 2nd test: Deserialization should now be correctly using the DB and done(null, null) should be erased.

Your code so far

 "use strict";

const express = require("express");
const fccTesting = require("./freeCodeCamp/fcctesting.js");

const session = require("express-session");
const passport = require("passport");
const mongo = require('mongodb').MongoClient;

const app = express();

fccTesting(app); //For FCC testing purposes
app.use("/public", express.static(process.cwd() + "/public"));
app.use(express.urlencoded({ extended: true }));

app.set('view engine', 'pug');
app.route("/").get((req, res) => {
  //Change the response to render the Pug template
  //res.send(`Pug template is not defined.`);
  res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});

  secret: process.env.SESSION_SECRET,
  resave: true,
  saveUninitialized: true,


const ObjectID = require('mongodb').ObjectID;

mongo.connect(process.env.DATABASE, {useUnifiedTopology: true, useNewUrlParser: true}, (err, db) => {
  if(err) {
    console.log('Database error: ' + err);
  } else {
    console.log('Successful database connection');

    //serialization and app.listen
    passport.serializeUser((user, done) => {
      done(null, user._id);
    passport.deserializeUser((id, done) => {
      //done(null, null);

        {_id: new ObjectID(id)},
          (err, doc) => {
             done(null, doc);


    app.listen(process.env.PORT || 3000, () => {
      console.log("Listening on port " + process.env.PORT);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

Challenge: Implement the Serialization of a Passport User

Challenge Link:

Wow never mind. Turns out I had to actually delete done(null, null); and not just comment it out.