I am currently trying to use the Astronomy validator package to validate required fields. However, it appears that inserts are happening even if the field is empty or null. Pls see below for how I am defining the collection and then doing an insert.
Any ideas what the issue might be?
Projects = new Mongo.Collection('projects');
AstroProject = Astro.Class({
name:'Projects',
collection: Projects,
fields: {
title: {
type: 'string',
validator: Validators.required()
}
}
}
});
MongoDB shell version: 2.6.7
connecting to: 127.0.0.1:3001/meteor
meteor:PRIMARY> db.projects.insert({});
WriteResult({ "nInserted" : 1 })
meteor:PRIMARY> db.projects.find().pretty();
{ "_id" : ObjectId("567850f74f1a8b92474f4e94") }
{
"_id" : "hny3BSh428rmN7gZh",
"title" : ""
}
meteor:PRIMARY>