im working on a next.js and mongodb website and im following this tutorial exactly but with different files/variable names. i keep running into this error when trying to access the dynamic page : Error: A required parameter (id) was not provided as a string in getStaticPaths for /location/[id]
tutorial : https://www.youtube.com/watch?v=MFuwkrseXVE&ab_channel=Academind Just before 2 hours 40 min
PS deleted db info for security reasons
export async function getStaticPaths(){
const client = await MongoClient.connect(''); ////////// username and password here for mongo db and db name
const db = client.db();
const destinationsCollection = db.collection('destination');
const destinations = await destinationsCollection.find({},{_id: 1}).toArray();
client.close();
return {
fallback: false,
paths: destinations.map((destination) => ({ params: {destinationId: destination._id.toString()},
})),
};
}