有两个表,一个用户表,一个订单表,现在想要查询所有 appId 为 1 的用户的订单应该怎么查询呢
const orderSchema = new mongoose.Schema({
user: {
type: mongoose.SchemaTypes.ObjectId,
ref: "User",
required: true
},
orderNum: {
type: String,
required: true
},
})
const UserSchema = new mongoose.Schema({
nickname: String,
avatarUrl: String,
phone: String,
appId: {
type: String,
}
});