I was wondering what the best way to define this schema is:

Newsitem can only have 1 userID and 1 task ID. A Task can belong to many newsitems. A user can belong to many newsitems
I've searched for examples, but I'd say they are not a lot of examples. How can I do this with mongoose & mongodb ? I'd say that both User to newsitem and Task to Newsitem are one to many relations.
In Mongodb you can reference a collection within a schema so when you find() a document in newsitem mongoose does a find() in user and task, so instead of returning the newsitem document it returns the newsitem with the user and the task.
Mongoose population
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With