在node.js中我使用expressjs,当连接到mongodb时,我遇到了麻烦,我不知道为什么会这样。我搜索它,但目前还不清楚。
(node) warning: possible EventEmitter memory leak detected. 11 reconnect listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at addListener (events.js:179:15)
at Server.connect (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/lib/server.js:291:17)
at open (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/lib/db.js:206:19)
at Db.open (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/lib/db.js:229:44)
at Function.User.get (/home/repository/nodejs/blog/N-blog/models/user.js:55:10)
at Context.<anonymous> (/home/repository/nodejs/blog/N-blog/test/models/userSpec.js:63:9)
at Test.Runnable.run (/home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runnable.js:233:15)
at Runner.runTest (/home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:390:10)
at /home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:473:12
at next (/home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:315:14)
at /home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:325:7
at next (/home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:260:23)
at Immediate._onImmediate (/home/repository/nodejs/blog/N-blog/node_modules/mocha/lib/runner.js:292:5)
at processImmediate [as _immediateCallback] (timers.js:367:17)
(node) warning: possible EventEmitter memory leak detected. 11 destroy listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at addListener (events.js:179:15)
at once (events.js:204:8)
at connectHandler (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/lib/server.js:265:19)
at g (events.js:199:16)
at emit (events.js:107:17)
at /home/repository/nodejs/blog/N-blog/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:399:23
at /home/repository/nodejs/blog/N-blog/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:806:13
at Callbacks.emit (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:95:3)
at null.messageHandler (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:246:23)
at Socket.<anonymous> (/home/repository/nodejs/blog/N-blog/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:262:22)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)