I am following the “MERN Stack Course - ALSO: Convert Backend to Serverless with MongoDB Realm” video on Youtube from freeCodeCamp.org and can’t get past an error I’m getting. I am using the same code as the video but have a companies database instead of restaurants and different fields. Not sure if maybe there is an issue due to that, but I’m getting an error of :
From just this information, it looks like the problem is that at some point in the code there is a destructuring assignment referencing filters. The value null cannot be destructured.
Nothing I’ve tried has worked so far. If there’s nothing further to try I’ll set up another database with the exact code from the video and mongodb database setup and see if I can get that working and go from there.
If I initialize everything to an empty object, I can start the server, but when I go to http://localhost:5000/api/v1/companies, I get a “this site cannot be reached, localhost refused to connect” page and the error in the console is:
if (filters) {
^
ReferenceError: filters is not defined
Looks like there is an issue with my setup , I created a new project and followed the video exactly and got to where I was before and was able to get the data from the database.
I did start the initial project on a Next.js app I am building so there’s probably an issue there. Any info on possible conflicts in creating a backend like in the “MERN Stack Course - ALSO: Convert Backend to Serverless with MongoDB Realm” but on Next.js would be greatly appreciated!
No worries, I should have looked for a Next.js specific resource. Thankfully I was able to find a " How to Integrate MongoDB Into Your Next.js App" how-to directly from Mongodb, I’m hoping that’ll do the trick!