-
Notifications
You must be signed in to change notification settings - Fork 530
Create a guide for many to many relationships #51
Comments
What's the preferred method? |
@niallobrien I'm pushing something up today |
Awesome, thanks. |
Any updates on this? |
@sscaff1 yes sorry I have some stuff in the works, basically if you need simple population you can just use the feathers I've been bogged down with work and we're not using sequelize so I'm hoping to have this guide wrapped up next week. |
Hi @ekryski, hope you are doing well. I was wondering if the guide is ready? if so where can I find it? and if not, then can you say when this would be available? Thanks for your help. |
I'm not sure if this is required any more since the new generator/cli v2.0.0, sets up the sequelize model structure for you automatically and you simply defined your many-to-many relationships the way sequelize tells you to. The one thing might be related to population. @DesignByOnyx you wouldn't be up for writing a blog post would you? That way we can stop answering questions in Slack and just point people to the post. |
I certainly don't mind writing a blog post regarding population. You are correct that the new generators make it easy to define relationships. However, the "populate" hook is still broken with sequelize and there is some work which being done to fix that (read here. I am also working on a sequelize "include" hook which can be used by sequelize users to take advantage of SQL joins. |
@DesignByOnyx have you spoken to @daffl about having |
This is now out of scope for the documentation. The database adapters document how to integrate with the ORM of choice. Blog posts are always welcome of course. |
According to the docs the preferred way is without using the orm adapters. As outlined here. The only example is the chat application but further examples and explanation of the proper way to use hooks to create relationships would be helpful such as a simple userrole or three table one to many and many to many example using the cli as the starting point would be appreciated. Thanks. |
my two cents worth - every many-many relationship will end up resolving
into: one---->>many<<-----one
Thank you,
Mark Edwards
…On Mon, Jan 21, 2019 at 9:54 AM David Luecke ***@***.***> wrote:
The FAQ on associations
<https://docs.feathersjs.com/faq/readme.html#how-do-i-do-associations>
has links to examples and plugins that can help with this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#51 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACyd4mHgM39_T784XsWIVH-5lAHptrhcks5vFfDBgaJpZM4HtRhp>
.
|
David that is what I was talking about in the FAQ the only example of not using an ORM is the chat application or as an alternative way of using a plugin. You have examples of using an ORM but more examples of using the preferred method besides just the chat app such as user-role or a three table one to many would be very helpful. Thanks.
How do I do associations?
Similar to validation, it depends on if your database/ORM supports models or not.
The preferred way
For any of the feathers database/ORM adapters you can just use hooks<https://docs.feathersjs.com/api/hooks.html> to fetch data from other services.
This is a better approach because it keeps your application database agnostic and service oriented. By referencing the services (using app.service().find(), etc.) you can still decouple your app and have these services live on entirely separate machines or use entirely different databases without having to change any of your fetching code. We show how to associate data in a hook in the chat guide<https://docs.feathersjs.com/guides/chat/processing.html>. An alternative are the fastJoin<https://feathers-plus.github.io/v1/feathers-hooks-common/#fastjoin> or populate<https://feathers-plus.github.io/v1/feathers-hooks-common/#populate> in feathers-hooks-common<https://feathers-plus.github.io/v1/feathers-hooks-common/>.
The ORM way
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
…________________________________
From: David Luecke <notifications@github.com>
Sent: Monday, January 21, 2019 11:54:25 AM
To: feathersjs/docs
Cc: Daniel Elebash; Comment
Subject: Re: [feathersjs/docs] Create a guide for many to many relationships (#51)
The FAQ on associations<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.feathersjs.com%2Ffaq%2Freadme.html%23how-do-i-do-associations&data=02%7C01%7C%7C533c2da93acf4a6f4a9e08d67fc119c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836864675737675&sdata=GxlnnJXVg%2B3%2FHxpBIKbCRA29FupbzC7UtioDQo%2FUws4%3D&reserved=0> has links to examples and plugins that can help with this.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffeathersjs%2Fdocs%2Fissues%2F51%23issuecomment-456138925&data=02%7C01%7C%7C533c2da93acf4a6f4a9e08d67fc119c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836864675737675&sdata=Kq8c1C3fjwrDUSIBjImA3k573bL990dY8x35GRuk7fg%3D&reserved=0>, or mute the thread<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACHggPhmTBxz4ZtYuiJDxj7n_dAgyGgGks5vFfDBgaJpZM4HtRhp&data=02%7C01%7C%7C533c2da93acf4a6f4a9e08d67fc119c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836864675737675&sdata=SCzY%2BUcz1qKFl%2FgqlfYQdwWHcp7xDadN7JdeRUcMCXE%3D&reserved=0>.
|
This keeps coming up over and over again and we need to have a concrete example we can point to for how you deal with many to many relationships with Feathers. We do have some stuff in the FAQ but I think we need a real guide.
Some related discussions to go off of:
The text was updated successfully, but these errors were encountered: