orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

Relationship filter to only sibling field #368

Closed Ajaxsoap closed 8 years ago

Ajaxsoap commented 8 years ago

Hi @nicolaslopezj ,

How do I filter the hasMany and hasOne to the related document?

use case: I have a form with a name children, parent and sibling fields, this fields are all relationship from other collections, the requirement is if I select name(hasOne) then the other fields children, parents and siblings will appear only based on the sibling name field. If I select name="John Doe", the children should be John Doe children and so on.

I've managed to filter it by user profile like i did on this issue.

Thanks,

Ajaxsoap commented 8 years ago

Hi @nicolaslopezj ,

I've seen this issue from @amejias101 here

This is somehow a supplementary to the comment above. I have issues on relationship attribute, my schema on my other collection hasMany children, when I relate this to other collection, only the first child from all documents are available, ideally, it should be all the children from the same document are available.

I think we should find a way to solve this issue, as orion is getting more popular.

My idea for this is to have a filter per document(_id), if the dev wants only the fields from one document.

if (doc._id) then return only the fields on that document, be an array or a single field, if (doc._all) then return from all documents.

Use case Insurance system like my current project, I have a personal info collection. InsuredName, Address, Contact, Children, Spouse and Parent.

On the my claims collection, from the personal info collection, I have a hasOne field Name, then hasMany dependent fields Children and Parent and so on.

The ideal situation is, when I create a claim, i will select one InsuredName then select dependent Children either one or many on the same document as InsuredName.

My current situation, when i create a claim, I will select InsuredName then dependent Children, but the problem is all the first child from other documents are available. How do we fixed this issue.

Thanks.

Ajaxsoap commented 8 years ago

I already solve my issue by creating a reactive variable, unfortunately, the relationship attribute is no use for my kind of use case.