Search code examples
mongodbone-to-manydata-modeling

How does one model a squilion to squilion relationship in mongodb


How does one model a squilion to squilion relationship in mongodb?

Something like users and post-likes.... A user can like over a squilion posts and a post can have over a squilion users that like it.

In one to squilion relationship, the identifier is placed in the child data, either by referencing or embedding. How does this translate over to squilion to squilion?


Solution

  • Use a dedicated model and collection for the likes. Each like references the post and the user.