radiegtya / meteoris2

a Realtime Javascript Boilerplate base on Meteor Js Framework
MIT License
246 stars 46 forks source link

How do you relate two collections meteoris using code generator? #74

Closed Ajaxsoap closed 9 years ago

Ajaxsoap commented 9 years ago

Hi, I have a scenario, I have two collections. enrollments collection claims collection

I have enrollees list in enrollments collection. How do I pass a certain fields from enrollments collection to claims collection with additional fields from the client?

Example Enrollments collection

NameBirthdateBirthdate
John 02/02/1990 Single Claim me!
Peter 02/02/1980 Married Claim me!

Let say i placed a claims button (Claim me!) per enrollee in the list, then if I click it, it will route me to add claims, the fields from that particular enrollee will be carried over plus additional fields(amount,dateofClaims), then click submit.
Claims collection

NameBirthdateBirthdateAmountDate Claimed
John 02/02/1990 Single $500 06/06/2015

How do i use the generator for this kind of scenario?

Thanks.

radiegtya commented 9 years ago

@Ajaxsoap Simply you can easily make enrollments collection with field:

or if you want relational (enrollment has one claim)

enrollments collection:

claims collection:

Ajaxsoap commented 9 years ago

Thanks @radiegtya!

However, I didn't get the output that I desired, the output that I want to achieve is passing a data from one collection to another. The approach that you suggested is simply putting a claims on enrollees but it didn't make sense if the enrollee is not yet claiming. The claim ID is supposedly appear after the enrollee claimed. Maybe, I have to figure this out by myself.

Thanks again and more power @radiegtya !

radiegtya commented 9 years ago

use the relational one then.

I think this is simply just logic, not much related to meteoris it self. I am closing this for now, feels free to reopen if you have another question.