I'm a newcomer to Meteor and I'm experimenting with a simple collection query on the client side. I've defined the Subject
collection in a common.js file at the root level, allowing access to it from files in both the client/
and server/
directories.
Issue: When I attempt to display some Subject
data in my home
template using the drop
helper, the data briefly appears and then disappears.
Upon logging the data in my helper function, I notice it appears in the following sequence, with approximately a 20-second delay between each logging:
[]
[Object]
[]
[Object]
Querying the server returns the results quickly and accurately. Here is what my Object looks like:
{"_id":"b97SpxtduH2spqLXw","id":"15920","upd":"2013-12-29 04:42:16","uuid":"be81554a-7759-11e4-adb6-57ce06b062da","term_id":"9000","lang":"en","part_speech":"","gender":"","term":"Terminologia Morphologica","source":"","description":"","wiki":"","email":""}]
I have simplified my code to the examples shown above. I have the autopublish
package installed, but the delay persists when querying on the client side. When I log the query within client.js, I get undefined
.
[Edit2:] Removing udondan:bulk-collection-update resolved the issue. Thank you. [Edit:] I have attempted removing all other packages, reinstalling Meteor, and using a different browser (Chrome 39.0.2171.71 (64-bit), Safari 8.0). I am running Yosemite OS X Version 10.10.1. root/subject.html:
<template name="home">
{{#each drop}}
Something {{this.term}}
{{/each}}
</template>
root/common.js:
Subject = new Mongo.Collection("subject");
client/client.js:
Template.home.helpers({
drop: function () {
var c = Subject.find({uuid: "be81554a-7759-11e4-adb6-57ce06b062da", lang: "en"}).fetch();
console.log(c);
return c;
}
});
My Meteor packages:
Users-MBP:subject user$ meteor list
accounts-github 1.0.2 Login service for Github accounts
accounts-google 1.0.2 Login service for Google accounts
accounts-twitter 1.0.2 Login service for Twitter accounts
accounts-ui 1.1.3 Simple templates to add login widgets ...
autopublish 1.0.1 Publish the entire database to all cli...
insecure 1.0.1 Allow all database writes by default
iron:router 1.0.3 Routing specifically designed for Meteor
meteor-platform 1.2.0 Include a standard set of Meteor packa...
nooitaf:semantic-ui 1.1.2 Semantic UI packaged for Meteor
udondan:bulk-collection-update 0.2.0 Bulk insert/update/delete documents in...