So I’m trying to create a posts array for each user so that each user would only post to their account and they can only view their own posts, this would look something like:
Tom = {
_id : 21r3qtg4r3wfe,
posts: [
{title: ‘life is cool’, content: ‘foobar’}, {title: ‘life is very cool’, content: ‘foobar foo’}
]
}
Joe = {
_id : 4355934294234,
posts: [
{title: ‘life is bad’, content: ‘barfoo’}, {title: ‘life is not so cool’, content: ‘barfoo bar’}
]
}
In my imports/methods.js I have:
Meteor.users.Posts = [];
Meteor.methods({
insertPost: function(userId,title,content){
Meteor.users.update(
{
_id: userId
},{
$push:{
Post:
{
title,
content
}
}
}
)
}
});
and in my template.body.helpers:
posts(){
return return Meteor.users.Posts
}
I’m sure I structured this wrong because I’m not getting anything back and I’m not sure how to fix it. Any help would be appreciated