javascript - MongoError:拓扑已关闭,请在创建新文档后连接
问题描述
我在猫鼬中执行某些任务时遇到困难,我有一个代码,在创建新实体后,我立即在另一个实体中进行选择,但是在进行此选择时遇到错误
MongoError:拓扑已关闭,请连接
保存后触发事件
if (this.emitter) {
await this.emitter('pre_create', {entity});
}
let response = await this.entity_class.create(entity);
if (this.emitter) {
await this.emitter('post_create', {entity: response});
}
从事件中的另一个集合中选择另一个实体
this.cache.account = await this.account_repository.find_one({
name: account_name
});
如您所见,我封装了猫鼬。
解决方案
推荐阅读
- ruby - 模型中的 Ruby on Rails DB 条目 (RoR 3)
- jquery - 渲染 vueJs 后重新编译模板
- python - Python 3.7.0- 其中 python3
- javascript - Firebase + js(角度)离开窗口时改变在线状态
- html - 枢轴图标不可点击
- azure - Azure 逻辑应用 Outlook 连接器的消息 ID 错误
- pyspark - 在pyspark中从时间戳转换为特定日期
- syntax-error - 在 rootSaga 在 rootSaga 在 watchFecthUsers 在 takeLatest 在 fetUsers ReferenceError: 错误未定义
- jquery - 获取下一个具有特定班级并删除班级
- ios - 关闭 AvPlayerViewController ios 后,音频正在 Avplayer 中播放