search

Home  >  Q&A  >  body text

javascript - mongoose save does not work and has no response~~

const register = async (ctx, next) => {
  console.log(123)
  const opts = ctx.request.body
  const newUser = await user.save(opts)
  console.log(newUser)
}

123 can be printed, and new User can also print, and then it stops when it comes to the save method. There is no response? ?

How is this going? ?

Looked at issues https://github.com/Automattic... Still not solved? ? what to do? ?

淡淡烟草味淡淡烟草味2691 days ago1330

reply all(1)I'll reply

  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-07-04 13:46:14

    Axiba is the reason for the mongodb connection, just put the code directly at the top

    const mongoose = require('mongoose')
    mongoose.Promise = require('bluebird')
    mongoose.connect('mongodb://localhost/blog')
    

    reply
    0
  • Cancelreply