MongoDB - Storing Data For Each User in User Collection or In Seperate Collection

Viewed 24

I'm using MongoDB right now, and I'm having a hard time deciding what structure is better.

If I were to build a todo app (lol), with users who own (they all have their own) their todo list, would it be better to:

A. I have a user collection, so I store all their tasks in the User object with an array, and then update that array whenever anything changes.

or

B. I have a seperate collection which solely stores the task array, and the _id is the same as the User _id, so I can just find it in the new array and update that? (Does this mean that I will have to find it every time I make an update, slowing it down?)

Or is there maybe a better way I'm not getting? Thanks!

0 Answers
Related