0

我扩展了猫鼬保存功能:

用户架构是:

var mongoose = require('mongoose');
var Schema    = mongoose.Schema,
ObjectId    = Schema.ObjectId;

var UserSchema = new mongoose.Schema({
  Name: String,
  Surname: String,
  login:   {type: String, required: true},
  Password:  {type: String, required: true},
  email: { type: String, index: { unique: true } },
  Age: Number
});

扩展方法是:

UserSchema.methods.save = function(okFn, failedFn) {
  if (this.isValid()) {
    this.__super__(okFn);
  } else {
    failedFn();
  }
};

在“保存”尝试时,它给了我错误:

TypeError: Object { object fields and values } has no method '__super__'
4

0 回答 0