Server Error TypeError: (0 , mongooseWEBPACK_IMPORTED_MODULE_0.model) is not a function
This error happened while generating the page. Any console logs will be displayed in the terminal window. --error above-- --code below--
import { Schema, model, models } from "mongoose";
const UserSchema = new Schema({ displayName: { type: String, required: true }, email: { type: String, required: true, unique: true }, phone: { type: String, unique: true }, password: { type: String }, pro: { type: Boolean, default: false }, author: { type: Boolean, default: false }, photoURL: { type: String }, }); const User = models.User || model("User", UserSchema);
export default User;