i want to publish a collection in Meteor with a find param and the param is, that it searches in the collection after the name of the user
I am using the Meteor accounts-password package and i maked sure the username is inserted in the Users collection but it does not work ;(
Meteor.publish("einladungen", function() {
return Events.find({ Eingeladen: Meteor.user().username });
})
I am searching in the Events collection a field in an array
the name of the Array is "Eingeladen" and when i put after the ": " the name "Hanna" then i get only the events where Hanna is find in the array so this is working fine but it only works for "Hanna" and not for the rest of the users
I appreciate every help ;) Thanks
Meteor.publish("einladungen", function() {
const username = Meteor.users.findOne(this.userId).username;
return Events.find({ Eingeladen: username });
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.