1
// From api/models/Person.js...
module.exports = {
attributes: {
// Primitive attributes
firstName: {
type: 'string',
defaultsTo: ''
},
lastName: {
type: 'string',
defaultsTo: ''
},
// Associations (aka relational attributes)
spouse: { model: 'Person' },
pets: { collection: 'Pet' },
// Attribute methods
getFullName: function(){
return this.firstName + ' ' + this.lastName;
},
isMarried: function() {
return !!this.spouse;
},
isEligibleForSocialSecurity: function(){
return this.age >= 65;
},
encryptPassword: function() {
}
}
};
이 객체의 배열 무거운 마음 SQL, 어떻게이 가질 수있는 속성을 것 같아? mongodb처럼. 예를 들어
어쩌면 내 사람 모델은 각 영화 당신은 모델 연결을 사용해야합니다