我正在编写有关Nodejs的教程,该教程使用猫鼬连接到MongoDB Atlas。问题是没有连接到MongoDB。
const dates = ["2014-13-01T13:81:00.862279Z", "2009-10-04T11:21:00.8322170Z", "2009-10-05T11:21:00.8322170Z", "2009-10-04T11:21:00.8422170Z"];
console.log(dates.sort());
如何建立连接:
{ MongoTimeoutError: Server selection timed out after 30000 ms
at Timeout.setTimeout [as _onTimeout] (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/sdam/server_selection.js:308:9)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
name: 'MongoTimeoutError',
reason:
{ MongoError: bad auth Authentication failed.
at _authenticateSingleConnection (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/auth/auth_provider.js:46:25)
at sendAuthCommand (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/auth/scram.js:215:18)
at _callback (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/connection/connect.js:320:5)
at Connection.messageHandler (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/connection/connect.js:349:5)
at Connection.emit (events.js:189:13)
at processMessage (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/connection/connection.js:368:10)
at TLSSocket.<anonymous> (/Users/rodrigo/Desktop/node_login/node_modules/mongodb/lib/core/connection/connection.js:537:15)
at TLSSocket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at TLSSocket.Readable.push (_stream_readable.js:220:10)
at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'MongoNetworkError',
[Symbol(mongoErrorContextSymbol)]: {} },
[Symbol(mongoErrorContextSymbol)]: {} }
我正在使用我的机器IP,并在mogoDB上检查了IP白名单。
答案 0 :(得分:0)
问题是密码网址上的“ <”