I read somewhere that I can write code for database queries in meteor in a synchronous manner.
var conversation = Meteor.conversations.findOne({
id: this.props.conversationId,
});
conversation.sendMessage(this.state.message);
When I run the above code fragment, it returns the following error:
Uncaught TypeError: Cannot read property ‘sendMessage’ of undefined.
Why is this? Should I move the conversation.sendMessage part to a callback?
Please help!