hoangvvo / nextjs-mongodb-app

A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
https://nextjs-mongodb.now.sh/
MIT License
1.54k stars 289 forks source link

null_ref #82

Closed qnxdev closed 4 years ago

qnxdev commented 4 years ago

null_ref

hoangvvo commented 4 years ago

What version of next are you using because I suspect you are using an older version? nextjs-mongodb-app only supports next.js v9.3 or later.

hoangvvo commented 4 years ago

This usually happens why you try to use mongodb on the client-side (probably by accident). Did you make any changes to the code?

hoangvvo commented 4 years ago

Also req.db.collection('posts') is incomplete. You probably want req.db.collection('posts').find().toArray() (find every document and transform them into array)

hoangvvo commented 4 years ago

Some pages will be SSR but most of them is SSG. You can first rename .env.example to .env to try it out.

For the error, I would need to know what changes you made to the code if any because I don’t see that on my dev env