Reputation: 3
In my MongoDatabase i have 5 elements.
First the _id then a follower with his idfollower and a following with his idfollowing.
now im trying to get only the IDFOLLOWING element
var userid = Relationships.findOne({follower: Meteor.user().username}).idfollowing;
this works!
Now i got 5 entries in the Database and the code only shows me 1 ID not 5
Upvotes: 0
Views: 81
Reputation: 64342
Give this a try:
// fetch an array of relationships where the current user is the follower
var selector = {follower: Meteor.user().username};
var relationships = Relationships.find(selector).fetch();
// create an array of ids? by extracting the idfollowing values from relationships
var userIds = _.pluck(relationships, 'idfollowing');
Here's the documentation for:
Upvotes: 2