I have this schemas:
UserLike
const UserLikeSchema = Schema({
user: {
type: Schema.Types.ObjectId,
ref: "User",
required: [true, "User is required"],
},
game: {
type: Schema.Types.ObjectId,
ref: "Game",
required: [true, "Game is required"],
}
});
Game
const GameSchema = Schema({
title: {
type: String,
required: [true, "Title is required"],
},
status: {
type: Boolean,
default: true,
},
});
I need to find all UserLikes where populated Game.status are true
I’m trying with a code like this
const games = await UserLike.find()
.populate("game")
.where("game.status")
.equals(true);
But I can’t find a solution 🙁