Mongoose - this.find() does not exist
<p>within my model, I am trying to do a static getUserByToken method. However, if I do it like in the documentation, I am getting</p>

<pre><code>this.find is not a function
</code></pre>

<p>My code looks like this:</p>

<pre><code>'use strict';

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const schema = new Schema({
    mail: {
        type: String,
        required: true,
        validate: {
            validator: (mail) =&gt; {
                return /^[-a-z0-9~!$%^&amp;*_=+}{\'?]+(\.[-a-z0-9~!$%^&amp;*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i.test(mail);
            }
        }
    },
    birthDate: {
        type: Date,
        required: true,
        max: Date.now,
        min: new Date('1896-06-30')
    },
    password: {
        type: String,
        required: true
    },
    ...
});


schema.statics.getUserByToken = (token, cb) =&gt; {
    return this.find({ examplefield: token }, cb);
};

module.exports.Schema = schema;
</code></pre>

<p>I am guessing it is just a simple mistake, however, I can not compile the model and than add the static function to the schema/model as this is done through an init function at startup, that compiles all the models.</p>

<p>Anybody can help me with that?</p>