How to search for a file using CFS:GridFS in meteorjs


#1

I used GridFS Package to create a file upload system in meteorjs this is the Code

     var files = event.target.files;
     FS.Utility.eachFile(event, function(file) {
           Files.insert(file, function(err, fileObj) {
             // Inserted new doc with ID fileObj._id, and kicked off the data upload using HTTP
             fileObj.createdBy = Meteor.userId();
             console.log(currentProject);

             if (err) {

             } else {
               console.log(fileObj);
               console.log(Files);

             }
           });
           v

But i am facing a problem when i return the files.
i am using the Find method

return Files.find({});

My problem is while uploading the file i added a property called createdBy that contain the current user id now i want to filter all files to get just the ones that are uploaded by the current user and i noticed that the Find method is in the FS.collection and not in the FS.file where all the properties are so i can not do something like

retuen Files.find({createdBy:Meteor.userId()});

so how to solve this is there anyway to get the properties files from a current file then filter them again?
Thanks in advance