猫鼬在嵌套模式中查找

Mongoose find in nested Schema

我尝试让所有用户 accountStatus.activated = false。但我就是做不到。

User.find({accountStatus: {activated: false}}) ...

controller.ts

import {User} from "../models/userModel";

public static getAllUsers(request, response, next): void {
    User.find().then(data => response.json(data)).catch(next);
}

用户模型

const user:Schema = new Schema({
    name_first: {
        type: String,
        required: [true, 'First Name is required (name_first)']
    },
     accountStatus: {
        activated: {
            type: Boolean,
            default: false,
            required: true
        },
     }
});

export const User: Model = model("User", user);

请帮助我 D:

使用点符号:

User.find({'accountStatus.activated': false})