Modules 5 and 6: Latest MongoDB container not compatible with reqests from results_server and survey_server.
Opened this issue · 0 comments
hilfigertout commented
The newest release of MongoDB does not support the queries made by the version of the Mongoose library in the results_server and survey_server in modules 5 and 6.
The containers start ok, but whenever attempting to submit a new entry from the form at localhost:8080, the survey_server crashes with the following error message:
MongoError: Unsupported OP_QUERY command: insert. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal
Attempting to visit localhost:3000 yields the error Cannot read property 'length' of undefined
.
After some digging, it appears that these legacy opcodes were deprecated in MongoDB 5.0 and removed in MongoDB 6.0. While I can't find them mentioned in the index.js files, the database queries must be using these opcodes.
Possible Solutions:
- Set the version of the MongoDB container to 4.0, instead of using
mongo:latest
to pull it. Pull request #56 addresses this issue, though at time of writing it only modifies the README in module 5 and doesn't fix the docker_compose.yml file in module 6. - Rewrite the code using the Mongoose library code with their newer methods. According to the warnings from the console, several methods from Mongoose are deprecated and should no longer be used.