scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

ReferenceError: schema is not defined #52

Closed kurdin closed 8 years ago

kurdin commented 8 years ago

Example from your README will throw error: ReferenceError: schema is not defined

constructor () {
 super();
 schema({
     name: String,
     valuation: {
         type: Number,
         default: 10000000000,
         min: 0
     },
     employees: [String],
     dateFounded: {
         type: Date,
         default: Date.now
     }
 });
}

right code is:

constructor () {
 super();
 this.schema({
     name: String,
     valuation: {
         type: Number,
         default: 10000000000,
         min: 0
     },
     employees: [String],
     dateFounded: {
         type: Date,
         default: Date.now
     }
 });
}
michaeljota commented 8 years ago

You are using this.schema, and it's plain schema. Check if that fix it.

kurdin commented 8 years ago

@michaeljota not sure what do you mean, can you explain please. What the right what to specify schema object without defining: this.name; this.valuation, this. employees .. etc?

scottwrobinson commented 8 years ago

@kurdin yep, you're right. Thanks for pointing this out!