Hi guys,
i really need your helps with meteor pub/sub.
i have not faced this kind of Bugs for so long . I know it is suppose to be a basic concept. But i am kind of missing something here. Please check my code and help me out. Please!
Thank you so much.
Love.
My collections
`
import { Mongo } from 'meteor/mongo';
export const CarDetails = new Mongo.Collection('carDetails');
`
My Collection method
`
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { CarDetails } from './carDetails.js';
Meteor.methods({
'saveCarDetails'(carType, carCapacity, carModels, carCapacityByWeight){
// check(carType, String);
// check(carCapacity, String);
// check(carModels, String);
// check(carCapacityByWeight, String);
return CarDetails.insert({
carType:carType,
carCapacity:carCapacity,
carModels:carModels,
carCapacityByWeight:carCapacityByWeight,
date: new Date(),
author: Meteor.userId()
});
}
});
`
Publications
`
import { Meteor } from 'meteor/meteor';
import { CarDetails } from '../carDetails.js';
Meteor.publish('trans_car_details', function () {
return CarDetails.find();
});
`
On the clients
import CarDetails from '/imports/api/cardetails/carDetails.js';
Tracker.autorun(function(){
Meteor.subscribe('trans_car_details');
});
Template.dashboard.helpers({
CarDetails() {
return CarDetails.find();
}
});