I'm developing a node.js + mongoose webapp, and I have one doubt about database creation. This is how database is defined:
var user = new Schema({
id : ObjectId,
name : String,
password : String,
email : String,
created : Date
});
var comment = new Schema({
id : ObjectId,
userId: ObjectId,
content : String,
created : Date
})
I want to link each comment with its user... So... which is the best way to do this? I thought to add one of these two to the comment Schema... but I don't know if its the correct answer or if there's another better:
userId: ObjectId,
or:
userObject: user
Thanks!
Hope you can help me!