In Meteor, the Images collection is undefined in the FS.Store.GridFS transformWrite function

244 views Asked by At

In the /Project/lib folder, I first declare an FS.Store.GridFS:

imageStore = new FS.Store.GridFS("images", {
    transformWrite: function(file, readStream, writeStream){
        if (something) {...}
        else {
            Images.remove({_id: file._id});
        }
    }
}

Then I declare the Image collection:

Images = new FS.Collection("images", {
   stores: imageStore
});

However, upon compilation, I get the error:

=> Exited with code: 8
...
W20150623-13:06:51.855(-4)? (STDERR)            throw(ex);
W20150623-13:06:51.855(-4)? (STDERR)                ^
W20150623-13:06:51.855(-4)? (STDERR) ReferenceError: Images is not defined
...

I have tried placing the imageStore declaration inside the Images declaration, with no success.

But importantly, it is not only Images that is causing an error for being undefined. If I include any variable name, it appears to be undefined within that else statement.

On top of all of this, the exact code works for my friend... Any help would be greatly appreciated.

1

There are 1 answers

0
Matt Wetmore On BEST ANSWER

Since you mentioned that it works for your friend but not you, it's probably not an issue with the code itself. Try running meteor reset.