Open etodanik opened 9 years ago
Unfortunately it does not. I'm looking at supporting it in a future version of Mongify.
Is there anything I can do to help? Would you accept a Pull Request? If so - give me kind of a 101 on your project structure, and where you'd be implementing a HABT support structure.
Yes, I would gladly accept pull requests.
As for a 101 of project structure, it's pretty straight forward, if you start looking at https://github.com/anlek/mongify/blob/master/lib/mongify/translation/process.rb
and processor_common.rb
. That's where all the magic happens ;)
@anlek is this feature request still open?
Yes, unfortunately I haven't had much time to work on Mongify (outside of small updates).
Thanks for your work so far! Maybe i have some time to start the implementation.
Hi @anlek et al,
Does anyone have a suggested work-around for many-to-many relationships with mongify?
Using the example above, and assuming users
and roles
should become separate documents in mongo, you would need to create both to get the mongo id.
In other words, is there a way I can add roles to the user object like so:
user: {
roles: [
{role_id: 'aaaaa...aaa01'},
{role_id: 'aaaaa...aaa02'}
]
}
@rot26, I don't think you can do this with the way Mongify works. There would have to be a after_save
to make this work. I'm currently swamped with work but I am hoping to re-write mongify so that it will allow you more flexibility but at the moment, it's just not possible.
You can try playing around with before save
and see if you can figure out a way to copy the old DB id into role_id and somehow update it afterwards. However, this is outside of the scope of help I can provide here.
any updates on many-to-many relationships with mongify?
Sorry, I've been swamped and have no time to dedicate to this. But will gladly review PR from anyone.
Take care, Andrew
I'm trying to migrate a database that among other things has a
has and belongs to many
relationship.Basically, I have a
users
table, aroles
table, and aroles_users
table that hasuser_id
androle_id
.Can I easily embed
role
intouser
?