Sunday, 15 July 2012

Node.js - Mongoose - How should I assign multiple Many-to-One relationships in this case? -


In this case, I need to assign a number of relationships, because you can see below:

Treasures: {East: var portfolio_suchi = new schema ({instability: number, bond: {percentage: {type: number, default: 0.6}, USA: (percent: {number: default, 0.7} {Percent: percent: {type: number, default: 0.4}, securities: [{type: object, ref: 'security'}}}, municipality: {percentage: {type: number, d Default: 0.2}, Securities: [{Object ID, Ref: 'Security'}}}, Corporate: {Percentage: {Type: Number, Default: 0.4}, Securities: [[Type: Ob EctId, Ref: 'Security' } {}: {Percent: {type: number, default: 0.3}, developed: {percentage: {type: number, default: 0.7}, securities: [{object: securities: [{type: object} , Referee: 'safety'}}}}, stock: {percent: {type: security}}}}, emerges: {percentage: {type: number, Default: 0.4}, United States of America: {percentage: {type: number, default: 0.7}, large cap: {percentage: {type: number, default: 0.4}, securities: [{type : {Percentage: {type: number, default: 0.4}, securities: [{object: referee: 'security'}}}, smallcaps: {percent: object, referee: 'security'}]}, middle cap: {percent: {Type: number, default: 0.2}, securities: [[percent: {type: number, default: 0.7} Securities: [{Type: object, ref: 'security'}}}}, international: {percent: {type: number, default: 0.3} securities: [{object: referee: 'security'}]}} }}, _goal: {type: 'security'}}}, excerpted: {percentage: {percentage: number, default: 0.3} object id, ref: 'round'}}); Var ProtectionSmain = New schema ({name: {type: date, required: true}, average rating: number, average number: number, percentage: number});

However, I think it's just using array instead of [[context: ObjectId, ref: '']) Will be easy in Security '}] .

I'm not sure what I should do. Anyone would know this in a proper way? Thanks!

If you only have your security objects, you [[type : ObjectId, ref: 'security'}] .

should be used.

No comments:

Post a Comment