I'm building sort of a question and answer system for my Meteor project. I have 3 collections: one named "Questions," one named "Answers," and one for admins to manually determine a question of the day, named "Today."
All collected answers will reference the question of the day. What I'm trying to figure out is how to make an insert statement for the "Answers" collection. Among the fields, it should add the ObjectId of the question being stored in "Today."
Answers.insert({
user: Meteor.userId(),
date: new Date(),
answer: answer,
questions_id: **here is where I would like the ObjectId of the current question**
})
How can I reference and insert an ObjectId
value, belonging to a field (let's call the field QOD) within the Today
collection? If you have an answer with an actual example, it would be great. I'm not so experienced that someone can describe a solution to me without showing it. Thanks.
Of course, I'll also have to figure out how to publish this stuff later. But I'll cross that road when I get there.