How to call a mongoose schema methods inside a controller

I want to use a custom schema methods inside my controller…

schema.methods.assignRole = function (role: string | IRole) {
    if (instanceOfIRole(role)) {
            this.role = role;
    } else {
        this.role.name = role;
    }

    this.role = role;

    return this.save();
};

inside a route “/user/toAdmin”: (this is not the definitive function just a “blueprint”)

router.get("/user/toAdmin", async (request: Request, response: Response) => {
    const user = await Users.findOne({ username: "administrator" });

    const role = {
        name: "admin",
        permissions: [
            {
                name: "view-user",
            },
            {
                name: "create-user",
            },
            {
                name: "edit-user",
            },
            {
                name: "delete-user",
            },
        ],
    };

    // ????
});


I’ve tried:

user.assignRole(role);

And got this error:

Property 'assignRole' does not exist on type 'Document<unknown, {}, IUser> & Omit<IUser & { _id: ObjectId; }, never>'.ts(2339)

sorry for my disastrous english I’m french :/