Meteor filter collection -
i'm trying secure accessing specific collection i'm having troubles doing it. have no problems disabling insert, update , delete collection.allow()
map.
the problem want filter results returned collection.find()
, collection.findone()
function. read meteor.publish()
, meteor.subscribe()
stuff, somehow cannot make work (it's not getting filtered, can see results).
in server-code following:
groups = new meteor.collection("groups"); meteor.publish("mygroups", function() { if (functions.isadmin(userid)) { return groups.find({ sort: { name: 1 } }); } });
the function i'm using works (so it's not it's returning true
).
in client-code wrote following:
meteor.subscribe("mygroups"); groups = new meteor.collection("groups");
now when groups.find{});
@ client still results (and should no result).
am misunderstanding or doing wrong? of course make collection server-side , use meteor.methods()
, meteor.call()
collection data (so it's encapsulated server). thought cool didn't have that.
also wonder why can't done on same level insert/update/remove collection.allow()
. mean, could have possibility add filter map reading data through find/findone.
like @tarang said, removing autopublish executing following command works:
meteor remove autopublish
Comments
Post a Comment