kumbhani bhavesh
kumbhani bhavesh

Reputation: 2247

Meteor get blank data from collection

i am using Meteor 1.4 and i'm trying to get data from data base collection but i got blank array . This is my code

Server side

import { Mongo } from 'meteor/mongo';
export const Employee = new Mongo.Collection('employee');

Client Side

import { Employee } from '/imports/api/employee/employee.js';
Template.employee.helpers({
employee_list: function() {
    var emp = Employee.find().fetch();
    console.log('emp', emp);
});

i successfully insert into same collection but if i try to get data than it's blank.

Upvotes: 0

Views: 20

Answers (1)

Oliver
Oliver

Reputation: 1380

Meteor works with pub/sub model, and, if the client is not subscribed to the collection, updates will not be propagated to it.

Upvotes: 1

Related Questions