MongoError:服务器已关闭MongoDB / mongoose中的错误

编程入门 行业动态 更新时间:2024-10-08 04:25:23

MongoError:服务器已关闭MongoDB / mongoose中的<a href=https://www.elefans.com/category/jswz/34/1771449.html style=错误"/>

MongoError:服务器已关闭MongoDB / mongoose中的错误

我试图在我的节点js环境中以及每当我为MongoDB运行测试时都运行Jest测试在Windows环境中,由于我的一些测试用例未通过而导致此错误。我在下面收到此错误


     queries › addRelatedPosts › should not override related posts that are there

    MongoError: server is closed

      at executeWriteOperation (node_modules/mongodb/lib/core/sdam/server.js:439:14)
      at Server.insert (node_modules/mongodb/lib/core/sdam/server.js:372:5)
      at Object.callback (node_modules/mongodb/lib/core/sdam/topology.js:938:15)
      at processWaitQueue (node_modules/mongodb/lib/core/sdam/topology.js:1036:21)
      at NativeTopology.selectServer (node_modules/mongodb/lib/core/sdam/topology.js:440:5)
      at executeWriteOperation (node_modules/mongodb/lib/core/sdam/topology.js:906:12)
      at NativeTopology.insert (node_modules/mongodb/lib/core/sdam/topology.js:595:5)
      at NativeTopology.insert (node_modules/mongodb/lib/topologies/native_topology.js:54:11)
      at insertDocuments (node_modules/mongodb/lib/operations/common_functions.js:259:19)
      at InsertOneOperation.execute (node_modules/mongodb/lib/operations/insert_one.js:26:5)
      at executeOperation (node_modules/mongodb/lib/operations/execute_operation.js:77:17)
      at Collection.Object.<anonymous>.Collection.insertOne (node_modules/mongodb/lib/collection.js:516:10)
      at NativeCollection.<computed> [as insertOne] (node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:173:28)
      at model.Object.<anonymous>.Model.$__handleSave (node_modules/mongoose/lib/model.js:274:33)
      at model.Object.<anonymous>.Model.$__save (node_modules/mongoose/lib/model.js:339:8)
      at node_modules/kareem/index.js:278:20

有人可以帮我吗,我这个问题困扰了一段时间了?

回答如下:

错误server is closed来自lib/core/sdam/server.js:439,并指示server.s.stateSTATE_CLOSINGSTATE_CLOSED

更多推荐

MongoError:服务器已关闭MongoDB / mongoose中的错误

本文发布于:2024-05-07 10:25:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1755818.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   服务器   MongoError   mongoose   MongoDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!