CentralData = new Mongo.Collection("centraldata");
NewColl = new Mongo.Collection('user-projects');
if (Meteor.isClient) {
Meteor.subscribe('user-projects');
console.log(NewColl.findOne());
}
if (Meteor.isServer) {
Meteor.publish('user-projects', function(){
var pathname = "," + this.userid + ",";
return CentralData.find({path: pathname});
});
So basically, I have some documents in the CentralData , but I want client to be able to access the documents with this format, where path is his userid. I
You may want to check your naming convention first. You seem to make your own code confusing by using same name for collection and publishing name.
Probably because of the confusions created by unclear naming… you are now publishing from ‘CentralData’ while trying to findOne from ‘NewColl’ in your console log. How could that not be undefined ?