Koa encountered being unable to get data when reading mongodb data

< H2 > question < / H2 >

when find () is used in findAddUsers.js , the data can be read normally, but there is no data in return

< H2 > Code < / H2 >

findAddUsers.js

const mongoose = require("mongoose")

let Schema = mongoose.Schema

let UserSchema = new Schema({
    name: String,
    age: Number
})

let temp = mongoose.model("temp", UserSchema)

exports.findAllUsers = async () => {
    let query = temp.find()

    let res = [1,2,3]

    await query.exec(function (err, users) {
        if (!err) {
            res = users
            // console.log(res) // 
        }
    })
    // console.log(res)  //  res 
    return res
}

app.js

const Koa = require("koa")
const app = new Koa()

const router = require("./router/router.js")

const mongoose = require("mongoose")
mongoose.connect("mongodb://localhost/db1")

app
    .use(router.home.routes())
    .use(router.home.allowedMethods())

app.listen(3000, () => {
    console.log("running")
})

router.js

const Router = require("koa-router")
const router = new Router()

const controller = require("../controller/user.js")

module.exports = {
    home: router.get("/", controller.getAllUsers) 
}

user.js

const userHelper = require("../dbhelp/findAllUsers.js")

module.exports = {
    getAllUsers: async (ctx, next) => {
        ctx.body = await userHelper.findAllUsers()
    }
}
Mar.08,2021

exports.findAllUsers = async () => {
    return await temp.find()
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e685-19cf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e685-19cf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?