Try posting your question here: 
 https://groups.google.com/forum/?fromgroups=#!forum/mongoose-orm

-g 

On Saturday, November 3, 2012 9:39:31 AM UTC-7, Alberto Gori wrote:
>
> I am trying to test validation on a very simple mongoose model, but I have 
> some problem with exceptions. 
>
> //model.js
>
> var ResourceDef = new Schema({
> name: {type: String, required: true},
> content: String,
> });
>
> var Resource = mongoose.model('Resources', ResourceDef);
>
> //test.js
>
> vows.describe('test model behavior').addBatch({
>  'validating a Resource object with name equals to null': {
>  topic: function() {
>  new model.Resource({
> name: null,
> content: '.....',
> }).validate(this.callback);
> },
>  'should throw an error': function(e) {
> assert.ok(e);
> }
>  }
> }).export(module);
>
>
> I get this error:
>
>     validating a Resource object with name equals to null 
>       ✗ should throw an error 
>         » An unexpected error was caught: ValidationError: Validator 
> "required" failed for path name 
>
> I don't understand why mongoose is throwing that ValidationError!
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to