mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
https://www.mongodb.com/compatibility/mongodb-laravel-integration
MIT License
7k stars 1.43k forks source link

Many to many relations #39

Closed AndreiArba closed 10 years ago

AndreiArba commented 11 years ago

Do you plan on adding many to many relation?

One way to achieve this is to keep an array of referenced objects in each entry. This would require two "inserts" for every change.

What do you think?

jenssegers commented 11 years ago

It is something I should take a look at, but I don't really know when. It's open for pull requests :)

royduin commented 8 years ago

Is this implemented yet? It's an old issue but I can't find anything about it in the readme but I came across some issues where people are talking about pivot tables... I need a many-to-many relation with the same collection, for example: I've got a "values" collection with a lot of values, I'd like to create a many-to-many relation between those values. Does Moloquent have something for this?

Edit: this is what I want: https://github.com/laravel/framework/issues/441#issuecomment-28891399 which is using the belongsToMany relationship which is supported by Moloquent, so I think I've answered my own question :) let's experiment with it.