我有这个帖子架构
const postSchema = new mongoose.Schema({
body: string,
authour: ref: 'User'
topic: {ref: Topics}
})
然后我将社区模式设置为
const CommunitySchema = new mongoose.Schema({
name: string,
authour: ref: 'User'
topics: [{ref: 'Topics'}]
})
,然后是一个用户架构
const UserSchema = new mongoose.Schema({
fullname: string,
communities: [{ref: 'Community'}]
})
如何使用数组参数数组进行查找查询。 我试过了,但是没用
Post.find({topic: user.communities.topics})
查询的外观如何?