Vote count:
0
Is there a way to prevent an entity creation if it contains an attribute that is not declared in api/models/YourModel?
For example, let's say I used MongoDB, and I have this User model:
module.exports = {
attributes: {
name:{type:'string'},
age:{type:'number'}
}
};
and I try to .create with this code:
User.create({name:'Walter Jr',age:8,missingTest:'something'}).exec(function createCB(err,created){
console.log('should fail');
});
Also, if a have a relationship/association to another model, should creation fail as well if the entity id points to an invalid entity?
Maybe I'm missing something, but so far the behaviour seems a bit strange to me.
asked 1 min ago
SailsJS prevent model creating with undeclared attributes
Aucun commentaire:
Enregistrer un commentaire