文章详情页
javascript - mongoose save不起作用也没有反应~~
浏览:319日期:2024-03-27 08:53:29
问题描述
const register = async (ctx, next) => { console.log(123) const opts = ctx.request.body const newUser = await user.save(opts) console.log(newUser)}
123能打印,new User也能打印, 然后到 save 的方法这里 就停住了 什么反应都没有??
这是怎么回事??
看了 issues https://github.com/Automattic... 还是没有解决??怎么办??

问题解答
回答1:阿西吧 就是mongodb连接的原因、把代码直接放在最上边就可以了
const mongoose = require(’mongoose’)mongoose.Promise = require(’bluebird’)mongoose.connect(’mongodb://localhost/blog’)
标签:
JavaScript
相关文章:
1. react-native 启动Android项目失败2. python - 用ffmpeg采集视频,用terminate没法结束进程3. nginx - 关于vue项目部署到ngnix后出现的问题4. node.js - nodejs+express+vue5. node.js - vue-resource,如何改变响应格式?6. css - 关于HTML中width和height的疑问(这个提问的标题不好起)7. javascript - 手机点击input时,button会被顶上去?求解决!!!8. html - css导航栏模糊,导航栏固定,随着页面滑动对下方页面产生模糊效果,如何实现?9. linux - python 安装 Anaconda 环境变量问题请教10. 网站在移动的环境下手机,pc打不开
排行榜

网公网安备