meteor - Why do these collection objects only contain _id? -
i have number of collections publishing client, 1 being stubborn:
on db there collection 'cargoes'. collection contains 2 documents, , have number of fields.
// in /lib/collections/cargoes.js cargoes = new meteor.collection('cargoes');
on server side we're publishing /server/server.js
meteor.publish('cargoes', function() { return cargoes.find(); } );
on client side we're subscribed in /client/main.js
meteor.subscribe('cargoes');
when type in cargoes.find().fetch(); in browser's (client's) console, 2 objects have correct _id values of objects expect back, but no other fields.
any ideas of going wrong, or how debug this?
edit1 - fixed typo in code, publish has had return, missed when entered on stackoverflow.
your publish function isn't giving back
meteor.publish('cargoes', function() { return cargoes.find(); });
-- update -- if isnt working, double check objects valid via mongo shell. meteor mongo
or mrt mongo
. ensure object doesnt have field named "length" . ensure can find().fetch() objects on server :
in file /server/main.js:
if ( meteor.isserver ) { console.log(cargoes.findone()); }
Comments
Post a Comment