when i try to enter the correct password and email it gave me an error and the file crashes
here is my terminal error
and my passport file enter image description here
and the schema file enter image description here
CodePudding user response:
You are accessing the Instance method directly without creating a Schema Instance, if you want to access a method like this
Schema.compare
You need to create a static method in Schema.
Example Static Method Creating :
// Assign a function to the "statics" object of our animalSchema
animalSchema.statics.findByName = function(name) {
return this.find({ name: new RegExp(name, 'i') });
};
// Or, equivalently, you can call `animalSchema.static()`.
animalSchema.static('findByBreed', function(breed) { return this.find({ breed }); });
const Animal = mongoose.model('Animal', animalSchema);
If you want to read more please follow this link