The github repository has been updated with the latest version of MongoDb so this module cannot be loaded:
import { connectToDatabase } from "../../util/mongodb";
Because the directory “…/…/util/mongodb” no longer exists. Instead, it is used:
import clientPromise from "../../lib/mongodb";
export default async (req, res) => {
const client = await clientPromise;
const movies = await client
.db()
.collection("movies")
.find({})
.sort({ metacritic: -1 })
.limit(20)
.toArray();
res.json(movies);
};