I have a collection created in collections.js
portfolioItems = new Mongo.Collection('portfolioitems');
This collection is then subscribed to in subscriptions.js
Meteor.subscribe('portfolioitems');
And published in publications.js
Meteor.publish('portfolioitems',function(){
return portfolioItems.find();
});
When I query Mongo from the server using db.portfolioitems.find(), it returns:
{ "_id" : "W9AeauCpMgPw2j5hf", "title" : "Commercial Design", "slug" : "commercial-design", "image" : "" }
However, when I try to find this item from the client or iron-router, the find method returns nothing. For example:
portfolioItems.find({'_id':'W9AeauCpMgPw2j5hf'});
Returns a LocalCollection.Cursor with undefined key values:
_selectorId: undefined
_transform: null
collection: LocalCollection
fields: undefined
limit: undefined
The findOne method works and returns the document:
portfolioItems.findOne({'_id':'W9AeauCpMgPw2j5hf'})
Object { "_id" : "W9AeauCpMgPw2j5hf", "title" : "Commercial Design", "slug" : "commercial-design", "image" : "" }
My challenge is returning all items with the same title. Using findOne() for this isn't suitable.
What could be the issue here?