intermittent "MongoAPIError: Server record does not share hostname with parent URI" when starting
helpStale
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have searched existing issues to ensure the bug has not already been reported
### Mongoose version
8.13.2
### Node.js version
24.3.0
### MongoDB server version
8.0.21
### Typescript version (if applicable)
_No response_
### Description
When starting server I intermittently get a "MongoAPIError: Server record does not share hostname with parent URI" error. Restarting server will usually succeed.
I added a "{ family: 4 }" parameter to the URI and thought that that had fixed the problem, but it is still occurring.
### Steps to Reproduce
My URI is
```const mongoUri = `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@${process.env.DB_HOST}?retryWrites=true&w=majority&appName=Cluster0`;```
mongoose.connect(mongoUri, { family: 4 })
### Expected Behavior
_No response_
关闭于 2026-06-12 10 条评论