Newbie question: returning Collection.find fields


I have an FS collection. In this FS collection I have uploaded some files. I have attached these files to a list. The list has an ID and that ID is passed and saved to the metadata of FS File.

In mongoDB I see this structure.
–> creatorId
–> createdAt
–> listId

I want to return to the uploads page only items that are relevant to the list.

So I try and return the collection using this.

    var currentList = this._id;
    return Uploads.find({metadata: [{listId: currentList}]}, {sort: {createdAt: -1}})

Can somebody offer some guidance?


you need Uploads.find(whatever).fetch() before you can use {{ #each uploads }}
And I think, not sure that you can use selector something like: { metadata.$.listId: currentlist }


Thank you!

This worked.

return Uploads.find({‘metadata.listId’: currentList})