MicrosoftDocs / mslearn-aks-workshop-ratings-api

Sample ratings API code for the AKS workshop on Microsoft Learn
MIT License
30 stars 333 forks source link

Fix Compatibility issue with MongoDB 6.0 #15

Open ahems opened 1 year ago

ahems commented 1 year ago

When I install MongoDb to my AKS cluster to use with this demo API using this command:

az aks command invoke --resource-group <myrg> --name <my cluster> --command "helm repo add bitnami https://charts.bitnami.com/bitnami && helm install ratings bitnami/mongodb --namespace ratingsapp --set auth.username=myusername,auth.password=mypassword,auth.database=ratingsdb"

I get this error thrown by the API when I try to call it using http://:3000/api/items

MongoError: Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal
    at Function.MongoError.create (/usr/src/app/node_modules/mongodb-core/lib/error.js:31:11)
    at queryCallback (/usr/src/app/node_modules/mongodb-core/lib/cursor.js:212:36)
    at /usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:469:18
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
ahems commented 1 year ago

The workaround for this issue is to use the previous version of MongoDB when deploying it for use by this code:

az aks command invoke --resource-group <myrg> --name <my cluster> --command "helm repo add bitnami https://charts.bitnami.com/bitnami && helm install ratings bitnami/mongodb --namespace ratingsapp --set image.tag=5.0.14-debian-11-r9,auth.username=myusername,auth.password=mypassword,auth.database=ratingsdb"