MongoNetworkError: connection 6 to closed

I am trying to simulate a seat reservation flow by a student. When the student tries to reserve a seat, certain fields in two documents (student document and study space document, both from different collection) should be updated. I can connect to my database, and the study space document can get updated. However, when trying to update my student data document, I keep getting this error

MongoNetworkError: connection 6 to closed

My code was working yesterday so I’m not sure why it failed today…Please help…
Here is my stack overflow question: node.js - MongoNetworkError: connection 5 to closed - Stack Overflow

It seems that I am unable to edit only, as I am still able to retrieve that student document.

Hi @Hui_Ying_Khoo and welcome to MongoDB community forums!!

Firstly, its always easier for us and other community users to help is all the details are posted on the same thread which avoid the toggle between two forums.
However, to understand the concern in more details, it would be helpful if you could share the following information:

  1. What is the version of the mongoose and MongoDB you are using?

Was there any changes made to the code during this interval?
3. As mentioned in the post, the code gets stuck, can you establish the connect to the database outside the application, using shell or Compass?
4. Also, do you see any error messages during this course of retrying the write operation?
5. The IP is the MongoDB server IP but from the screenshots attached, it seems that you are trying to make connection with Atlas. Can you confirm if this is Atlas or a local database connection?
6. Can you confirm if the update happens in the database but is not reflected in the code?
7. Finally, can you share the mongoose code where you are trying to make the connection to the database?