I currently have a Channels collection which is stored as the following:
{ "_id" : ObjectId("4f5d1012d48147e840000000"), "title" : "Testing", "description" : "hello!", "created" : "2012-03-11 20:50:26", "user" : ObjectId("4f5d0408d48147207f000000") }
But I would like users to now be able to subscribe to this channel. I don't think this important enough to be considered its own collection so I would like to store it as the following:
{
"_id" : ObjectId("4f5d1012d48147e840000000"),
"title" : "Testing",
"description" : "hello!",
"subscriptions" :
{ "user" : ObjectId("USERIDHERE"), "created" : DATETIME },
{ "user" : ObjectId("USERIDHERE"), "created" : DATETIME },
{ "user" : ObjectId("USERIDHERE"), "created" : DATETIME }
"created" : "2012-03-11 20:50:26",
"user" : ObjectId("4f5d0408d48147207f000000")
}
Though I cant seem to get my head around how to cleanly implement this within my Lithium object. Would my $story->vote
property be an array which I push to on every update?