Relative Content

Tag Archive for mongodbmongoosenext.js

Next.js GET response from mongoDB is undefined

I’m writing a blog with Next.js and mongoDB with mongoose to learn CRUD with the stack. When I log the return from the Post.find() in the backend everything looks fine and is working as expected. But when it goes to the frontend in a next response it is undefined. my guess is I am applying JSON.stringify wrong or I am messing up with asynchrony somewhere (I’m also newish to Next but know React). Here is my backend code: