mongoose定义完成schema查询不到数据

schema是这样定义的

 const mongoose = app.mongoose;
    const { Schema } = mongoose;
    const UserSchema = new Schema({
        phone: {
            type: String
        },
        unphone: {
            type: String
        }
     
       
    });

    return mongoose.model('DayTraininga', UserSchema);

查询方法

 async trainingDays() {
            const { ctx } = this;
            let phone = ctx.get('x-user-id');
            let count = ctx.model.DayTraining.find({  },function(err,counqt){

                console.log('count*****************',counqt)
            });
            return count > 0 ? count : 1;
        }

数据库
图片描述

数据结构
图片描述

找了好多资料,说是mongoose会自动在后面加s云云,我加s去s都式了,就是不可以

阅读 1.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题