Closed anujaggarwal closed 1 year ago
Thanks for reporting. Mongoose updated to version 6 from version 5, so the behaviour changed. I've updated the tutorial and worked version of tutorial to use mongoose 6. That should remove the warnings, and MAY remove the buffering timeout.
Fixed. Thanks for reporting
MDN URL
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose
What specific section or headline is this issue about?
Testing — create some items
What information was incorrect, unhelpful, or incomplete?
Section "Testing — create some items" talks about using populatedb.js script to create fictional objects in the database.
When the script is executed through command line, it might result in the below error for some users:
What did you expect to see?
The script should have executed with out any error.
Correct output after I fixed the script and re-ran it:
Do you have any supporting links, references, or citations?
I believe others have also faced this issue as reported here:
There seems to be a genuine issue with the script although I am just a beginner and can not say this with absolute confidence.
But further reading on this error took to the below links which talk about this issue and possible fixes in detail:
Looks like some timing issue and hence people are suggesting to wait and sync properly.
If there is some understanding issue for beginners, I would request the page to be updated accordingly.
Do you have anything more you want to share?
As I am just a beginner and wanted to focus on the main article, I just added some wait in the script by putting this code before
async.series()
:This adds a delay of 5 sec and the connections are properly established and hence the script executes like a charm.
Ref: https://stackoverflow.com/questions/14249506/how-can-i-wait-in-node-js-javascript-l-need-to-pause-for-a-period-of-time
MDN metadata
Page report details
* Folder: `en-us/learn/server-side/express_nodejs/mongoose` * MDN URL: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/learn/server-side/express_nodejs/mongoose/index.md * Last commit: https://github.com/mdn/content/commit/1f4c6bc8ea56c9ee2aa0087ce69b89343bc66fd9 * Document last modified: 2022-12-19T10:07:55.000Z