错误"/>
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.state
是STATE_CLOSING
或STATE_CLOSED
。
更多推荐
MongoError:服务器已关闭MongoDB / mongoose中的错误
发布评论