I have a meteor collection with the below structure. This actually comes from a Meteor-files
collection by ostrio
.
{
"_id" : "HsXoZ6bxkx5kMcJtm",
"name" : "trees.jpg",
"meta" : { "artist_id" : "QkmYdsZsMmRzqTg58" , "artist": "some name"},
"mime-type" : "audio/mp3",
"userId" : "QkmYdsZsMmRzqTg58",
"_collectionName" : "images"
}
I define a publication
Meteor.publish('files.artist', function publishUserImages(){
return Images.find({meta: {artist_id: this.userId}).cursor;
});
I want to filter on the meta
key, to return all items with artist_id
.
My current filter will get only those Images where meta
has the exact value {artist_id: "QkmYdsZsMmRzqTg58"}
. The filter won’t return the item shown above since it the meta
value has an extra key artist
How do I construct an appropriate filter?