You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,18 @@ Add code to connect to the server and the database **myProject**:
133
133
> However, all async API calls support an optional callback as the final argument,
134
134
> if a callback is provided a Promise will not be returned.
135
135
136
+
> **NOTE:** Resolving DNS Connection issues
137
+
>
138
+
> Node.js 18 changed the default DNS resolution ordering from always prioritizing ipv4 to the ordering
139
+
> returned by the DNS provider. In some environments, this can result in `localhost` resolving to
140
+
> an ipv6 address instead of ipv4 and a consequent failure to connect to the server.
141
+
>
142
+
> This can be resolved by:
143
+
> - specifying the ip address family using the MongoClient `family` option (`MongoClient(<uri>, { family: 4 } )`)
144
+
> - launching mongod or mongos with the ipv6 flag enabled ([--ipv6 mongod option documentation](https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod.--ipv6))
145
+
> - using a host of `127.0.0.1` in place of localhost
146
+
> - specifying the DNS resolution ordering with the `--dns-resolution-order` Node.js command line argument (e.g. `node --dns-resolution-order=ipv4first`)
0 commit comments