MongoError: failed to connect to server [localhost:27017] on first connect
at .<anonymous> (/Library/WebServer/Documents/nodeprojects/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:96:13)
at emit (events.js:188:7)
at .<anonymous> (/Library/WebServer/Documents/nodeprojects/node_modules/mongodb-core/lib/connection/pool.js:260:12)
at g (events.js:286:16)
at emitTwo (events.js:106:13)
at emit (events.js:191:7)
at Socket.<anonymous> (/Library/WebServer/Documents/nodeprojects/node_modules/mongodb-core/lib/connection/connection.js:162:49)
at Socket.g (events.js:286:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at connectErrorNT (net.js:1015:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
名称:'MongoError', 消息:'首次连接时无法连接到服务器[localhost:27017]'} /Library/WebServer/Documents/nodeprojects/node_modules/mongodb/lib/mongo_client.js:225 扔错了 ^
TypeError:无法读取null的属性'collection' 在/Library/WebServer/Documents/nodeprojects/server.js:30:29 在connectCallback(/Library/WebServer/Documents/nodeprojects/node_modules/mongodb/lib/mongo_client.js:315:5) at /Library/WebServer/Documents/nodeprojects/node_modules/mongodb/lib/mongo_client.js:222:11 at _combinedTickCallback(internal / process / next_tick.js:67:7) at process._tickCallback(internal / process / next_tick.js:98:9)