mongoose - 如何根据ref _Id mongoose在第二个文档中的条件在一个文档中查找
问题描述
例如
RecordSchema = {
user:{
type: Schema.Types.ObjectId,
ref: 'User'
}
transcations:[Object]
title:String
}
UserSchema:{
name:String,
active:Boolean
}
我想找到用户活跃的所有记录
例如
records = await Record.find({title:req.query.title}).populate('user).where(
user.active, true);
解决方案
推荐阅读
- python - 将 Python Flask 应用程序部署到 Heroku 崩溃了
- php - apache 临时通过脚本启动 VirtualHost
- ruby - Ruby中浮点变量的最大值
- javascript - 正则表达式 (Regex) 一次只允许数字或带有数字的特定字符
- javascript - 如何正确过滤数组
- java - 如何在不删除拆分字符的情况下拆分字符串
- snmp - SNMP - 如何设置空值或空值
- powershell - 使用大块通过 PNP-Powershell 递归地将大文件上传到 Sharepoint Online
- sparql - 在 Sparql 中查询以获取人员的数据
- grails - BootStrap.groovy 中的访问控制器请求参数