I'd like to know if it's a good practice to create a relationship between two collections in MongoDB.
Suppose I have a collection for users, with a scheme something like this:
{
"_id": ObjectId(...),
"username": "",
"groups": [
ObjectId(...),
ObjectId(...)
]
}
But the ID's placed in the array groups
would be referring to the ID's of the groups in the collection "groups".
Is this a good practice or should I use SQL for this? If it's good practice, how can I create this kind of thing in MongoDB?