meteor - Using cfs:http-publish -
i'm trying use cfs:http-publish package @ https://github.com/collectionfs/meteor-http-publish. while i've got get - /api/list
functionality working, don't know how obtain single document:
(get - /api/list/:id - find 1 published document).
can provide curl example of this, assuming collection of objections. eg: {a:3, b:2}
, {a:4, b:3}
, , requiring obtain object {a:3}
.
thanks.
you need put in query function.
http.publish({collection: mylist},function( ){ return mylist.find(this.query); });
this.query contains data sent request.
curl http://localhost:3000/api/mylist?a=3
i don't know enough mongo know if potential security risk, if can comment on please do.
Comments
Post a Comment