After a short while of successfully running, the application randomly crashes and terminal outputs the following error log:
My .env file contains the following code: DATABASE_URL=mongodb://127.0.0.1:27017/T-shirts-2
I’ve tried changing “127.0.0.1:27017” in many ways e.g to “localhost:27017” or just “localhost”, but those changes only made another errors pop-up in the place of the previous one.
I suppose it is the problem with just the hostname, but somehow i can’t get it right. Maybe somebody knows how to solve that problem?
I would really appreciate any help.
@Grzegorz_Diaconescu the error is being forwarded from the Node.js Driver as the payload being returned from the server exceeds the max document size.
The result you’ve reported (1.34GB???) in the error seems way off, so something’s clearly not right here.
To start off, what versions of the MongoDB server are you running locally and what version of Mongoose is being used? Did you start the
mongod with any custom options?
So i’m running MongoDB shell version v3.6.4 and Mongoose v7.2.1.
As i can remember i did not change any of the mongod default options.
@Grzegorz_Diaconescu seeing as the version you’ve indicated (3.6.4) is considered End of Life I’d recommend upgrading the server version to at least MongoDB 4.4.
The version of Mongoose shouldn’t be an issue, however due to the server version being several generations old it’s potentially contributing to the issue.
If after upgrading MongoDB to 4.4+ these issues persist we can investigate further.
Yeah I’ve tried updating MongoDB via brew and now the whole app is not crashing.
Previously I’ve tried updating it via npm, and somehow it didn’t have the latest MongoDB version available.
Yeah so pretty much the cause of the error is solved.
Thank you very much for your help