所以我有这个模式
const Document = new mongoose.Schema({
_id:{
type:Number
},
creationDate:{
type:Date,
default:Date.now(),
},
title:String,
status:{
type:String,
default:status.PENDING
},
description: String,
category:[{
type:mongoose.Schema.Types.ObjectId,
ref:'Categories',
}],
})
Run Code Online (Sandbox Code Playgroud)
我如何找到其类别数组包含给定 id 的文档?我的意思是像使用类别 id 获取所有文档的查询