我正在用node.js中的express和mongodb运行一个简单的REST API,并且出现此错误:
{ MongoError: no primary server available
at ReplSetState.pickServer (/Users/Computer/Desktop/Username/node_modules/mongodb/lib/core/topologies/replset_state.js:780:12)
at Timeout._selectServer [as _onTimeout] (/Users/Computer/Desktop/Username/node_modules/mongodb/lib/core/topologies/replset.js:1147:43)
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: 'MongoError', [Symbol(mongoErrorContextSymbol)]: {} }
This has already been posted,但回复对我没有帮助
答案 0 :(得分:0)
我遇到了同样的问题,因为我忘记在mongoDB上将我的IP列入白名单了。