Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Schema is not defined #9

Closed
cesar2064 opened this issue May 30, 2016 · 2 comments
Closed

ReferenceError: Schema is not defined #9

cesar2064 opened this issue May 30, 2016 · 2 comments

Comments

@cesar2064
Copy link

I used the example of readme file, and after the server starts I got the error ReferenceError: Schema is not defined

  static schema () {
    return {
      username: String,
      childs: [{
       type: Schema.ObjectId,
        ref: 'UserSchema'
      }],
      email: {
        type: String,
        type: String,
        required: true,
        unique: true,
        lowercase: true,
        trim: true,
        validate: {
          validator: function (val) {
            return isEmail(val)
          },
          message: '{VALUE} is not a valid email'
        }
      }
    }
  }

apparently the scope of the schema variable, has been lost

@konstantinzolotarev
Copy link
Collaborator

@cesar2064 Yep Schema is default Schema from mongoose.
You could add it using

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

@cesar2064
Copy link
Author

cesar2064 commented Jun 2, 2016

Ok thanks, @konstantinzolotarev resolved my problem. I think you should update the trailpack-mongoose example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants