The problem of using then after mongoose save operation.

  mongodb, question

This is my save operation, but the output order of the print statements is
B: undefined A: correct content

router.post('/reply', (req, res, next) => {
 let topic_id = req.body.topic_id,
 content  = req.body.content
 
 let replyEntity = new replyModel({
 author: req._id,
 topic: topic_id,
 content
 })
 replyEntity.save((err, _new_reply) => {
 if (err) {
 return res.json({
 status: -1
 })
 }
 console.log('A: '+_new_reply)
 return _new_reply
 })
 .then((reply) => {
 console.log('B:  '+reply)
 return res.json({
 status: 0
 })
 })
 })

Why?thenThe contents of the operation will be executed first and should not wait for me.save promiseDid you just go back and do it?
I have already specifiedmongoose.Promise = Promise;
I hope someone can help me solve it.

You’re confused,

replyEntity.save((err, _new_reply) => {
 if (err) {
 return res.json({
 status: -1
 })
 }
 console.log('A: '+_new_reply)
 return _new_reply
 })
 .then((reply) => {
 console.log('B:  '+reply)
 return res.json({
 status: 0
 })
 })
 })

You got callback and promise together

Link description