angularjs - Fetch single field from mongodb in meteor -
i'm new meteor framework want fetch single collection
accountnames = new mongo.collection("accounttypemaster");
i created collection using
db.createcollection("accounttypemaster") this.helpers({ accountnames: () => { return accountnames.find({}, {fields: {name: 1}}); } });
using above query i'm unable fetch single field "name" collection. i'm sure what's wrong code.
you need change how instantiate collection. correct meteor syntax be:
accountnames = new mongo.collection("accounttypemaster");
helpers need attached template. remember, helpers run on client-side code.
if (meteor.isclient) { // code runs on client template.body.helpers({ tasks: function () { return accountnames.find({}, { fields: { name: 1 } }); } }); }
Comments
Post a Comment