Open magh20 opened 10 months ago
If you connect to a MongoDB database using the mongodb+srv:// connection scheme, there needs to be some custom DNS entries in existence to accompany the setup.
In you example above your DNS is cluster.3caigv3.mongodb.net and you will be connecting to it on port 27017. So you need an A record for this.
Inside the cluster, there will also need to be DNS A records for each of the replicas e.g. mongodb-0.cluster.3caigv3.mongodb.net, mongodb-1.cluster.3caigv3.mongodb.net and so on...
Finally, you need to have a DNS SRV record for _mongodb._tcp.cluster.3caigv3.mongodb.net which lists all of the replicas and ports where MongoDB can be found.
So in summary: you connect via the mongodb+srv scheme and then it instructs you to lookup the SRV record in DNS for _mongodb._tcp.cluster.3caigv3.mongodb.net which, in turn, directs you to the pool of replicas!
Have a read of the documentation here https://www.mongodb.com/docs/manual/reference/connection-string/
Error: querySrv ENOTFOUND _mongodb._tcp.cluster.3caigv3.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:251:17) at QueryReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: undefined, code: 'ENOTFOUND', syscall: 'querySrv', hostname: '_mongodb._tcp.cluster.3caigv3.mongodb.net' }
users.findOneAndUpdate()
buffering timed out after 10000ms at updateUser (./src/lib/actions/user.actions.ts:34:15) 33 | } 34 | } catch (error: any) {Hello, how can i fix this? I try anything and it doesn't work, Please help me.