Here is my problem
I have declared my Collection outside MeteorisServer and MeteorisClient wrappers.
var Items = new Meteor.Collection("items");
I then insert my Items Collection with array x and array z.
Items.insert({
owner: x,
post_id: z,
draft: true
});
When console.log(Items.find().fetch())
is outputted onto the screen server side I see this in the command line.
Server
{ owner:
[ 'Sneaker of the Week: \n\nThe women\'s Roshe Flyknit multi-color arrives soon. #roshe http://t.co/1Zfothclmz\n',
'Sneaker of the Week:\n\nThe men\'s Roshe Flyknit is now available: http://t.co/frqNCZQbS5 #roshe http://t.co/HOAbnKFUDZ\n',
'Modern comfort. The men\'s Roshe Flyknit is now available: http://t.co/zwTWPMpyYK #roshe http://t.co/l7ZLm67sNC\n',
'A full-fledged phenomenon, her destiny is to change tennis and the culture, one fallen rival at a time. #techpack http://t.co/TksxyQTUpr\n',
'Her youth conceals an aggressive game of precise strikes and high-tempo performances. #techpack http://t.co/khqgKdZsfv\n',
'Always ready, Genie Bouchard is steady crafting her legacy on the tennis court. #techpack http://t.co/U3WTP6Arax\n',
'Sneaker of the Week:\n\nThe men\'s Dunk CMFT is now available: http://t.co/WFFCBNxICZ http://t.co/OByzzLLdlL\n' ],
post_id:
[ 'http://pbs.twimg.com/media/B-f5AF0IcAAQkZY.jpg',
'http://pbs.twimg.com/media/B-eHJ8tIIAAFUgO.jpg',
'http://pbs.twimg.com/media/B-TZZx7IIAAH9EH.jpg',
'http://pbs.twimg.com/media/B-PBNPkCQAAJq0w.jpg',
'http://pbs.twimg.com/media/B-O_zjaCUAEb6Fj.jpg',
'http://pbs.twimg.com/media/B-O9HhQCAAAIxHM.jpg',
'http://pbs.twimg.com/media/B-ApJnQIgAQisgR.jpg' ],
draft: true,
_id: '3GW4oqzNHZw9p6yLQ' },
I then publish this on the server side
// Publish the logged in user's posts
Meteor.publish("posts-recent", function () {
return Items.find({ owner: x });
});
Client
To then receive it on the client-side.
Meteor.subscribe('posts-recent');
var newItems = Items.find();
console.log(newItems);
Console
Unfortunately this just outputs an a reference to an empty collection declared at the start of the file. My client-side just doesn't seem to be able to receive this data at all. Also when I search for Items in the console inspector I am told it is undefined. So does anyone have any idea if there is any issue with the way I use publish and subscribe?