0
很抱歉的模糊冠军,但我想要做的是以下几点: 我有2种獴型号:帖子和用户(可以是帖子的作者)猫鼬Model.find - >编辑 - >回调?
const Post = new Schema({
title: {type: String, required: true, unique: true},
content: {type: String, required: true},
date_created: {type: Date, required: true, default: Date.now},
authorId: {type: String, required: true}, // ObjectId
author: {type: Schema.Types.Mixed},
page: {type: Boolean, required: true, default: false}
});
post.find()
猫鼬发送查询的MongoDB
的MongoDB返回文档
中间件检索基础上,authorId
财产笔者
Add找到用户的帖子author
场
post.find callback
这可能吗?
谢谢! 这的确有诀窍! ^^ 代码现在工作:) '常量体=收率this.Model.find() .populate( 'AUTHORID') .lean();' – CreasolDev