I'm new to meteor and I am in the process of building my application, but I am running into some "best practice" questions.
I have three databases. One for the users, one for questions, and one for answers. Think of my site as a quora of sorts.
I am iterating through the questions, and I am having a hard time accessing the user information. At the moment when a question gets recorded, I record the question, and I only record the user's id. Coming from a rails background, this is usually all I need to access all the other information when I need it. I don't record the name and all the other info.
The question I have is what is the right way to access the user information? I am doing an each loop and it seems that Meteor.user is only for logged in users (only for my information basically). I can't seem to do something like Meteor.users.find({_id: this.user_id}) on the questions helper so that I could get each users info. It retrieves nothing like this.
In the examples I have seen, they usually record the information on the questions database. So they would record first,last name, and anything else that would be necessary. But this seems like I am recording information twice.
What is the right way to access this info? Should I record it when a question is posted or should I call it from the users database everytime?
I have tried accessing the info through a server method, but can't seem to get it to work. Been at this for a while so I though I should ask instead.
Thanks in advance!!
My solution would be just save the user_id field in db as you're doing right now,
If you save
firstname
orlastname
with the questions they may change in future (considering the fact that in most sites we have option to change names)this is because user data is not availbale in the client, that is the reason why you can't see the data
solution is while publishing the question to client you should publish the information of the user too
Example
Now, in the client side when you do I can't seem to do something like
Meteor.users.find({_id: this.user_id})
you'll get the user data.