欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MongoDB: UnhandledPromiseRejectionWarning: MongoError: Cannot use a session that has ended

程序员文章站 2022-04-01 15:50:52
...
(node:11104) UnhandledPromiseRejectionWarning: MongoError: Cannot use a session that has ended
    at applySession (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\sessions.js:707:12)
    at _command (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\wireprotocol\command.js:58:17)
    at command (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\wireprotocol\command.js:28:5)
    at writeCommand (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\wireprotocol\write_command.js:47:3)
    at Object.insert (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\wireprotocol\index.js:6:5)
    at Connection.insert (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\connection.js:178:8)
    at E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\sdam\server.js:454:13
    at Object.callback (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\connection_pool.js:351:7)
    at E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\connection_pool.js:505:23
    at E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\connection_pool.js:431:7
    at callback (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\connection\connect.js:97:5)
    at E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\connection\connect.js:169:5
    at E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\core\connection\connect.js:334:7
    at MessageStream.messageHandler (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\connection.js:270:5)
    at MessageStream.emit (events.js:311:20)
    at processIncomingData (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
    at MessageStream._write (E:\work_space\enforce\mc\cloudenforce\opcsec\contrail-web-core\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
    at doWrite (_stream_writable.js:441:12)
    at writeOrBuffer (_stream_writable.js:425:5)
    at MessageStream.Writable.write (_stream_writable.js:316:11)
    at Socket.ondata (_stream_readable.js:714:22)
    at Socket.emit (events.js:311:20)
(node:11104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)