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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -