I’m new to NOSQL and Mongo and am aware of the unbounded arrays anti pattern and the 16MB size limit for documents. After doing some research, I noticed that objects with a many:many relationship need to reference each other. For example, for argument’s sake, let’s say there are users and tasks - a user can have many tasks, and a task can have many users. I would think to structure the database like this:
user {
_id: 123,
name: ‘bob’,
tasks: [987, 1, 2, 3, …, N] // task reference _ids
}
task {
_id: 987,
name: ‘water the plants’,
users: [123, 1, 2, 3, …, N] // user reference _ids
}
So each task can reference its users and each user can reference its tasks. However, for argument’s sake, let’s say that both the number of users and tasks are unbounded. This would mean that the users array in the a task object is unbounded and could exceed the 16MB limit, and the tasks array in a user object is also unbounded and could exceed the 16MB limit. So my question is how could this many:many relationship scale without exceeding the 16MB limit?
I feel like I could be missing something here. Thanks for any help