在/Project/lib
文件夹中,我首先声明一个FS.Store.GridFS:
imageStore = new FS.Store.GridFS("images", {
transformWrite: function(file, readStream, writeStream){
if (something) {...}
else {
Images.remove({_id: file._id});
}
}
}
然后我声明图像集合:
Images = new FS.Collection("images", {
stores: imageStore
});
但是,在编译时,我收到错误:
=> 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
...
我尝试将 imageStore 声明放入 Images 声明中,但没有成功。
但是重要的是,导致未定义错误的不仅仅是图像
。如果我包含任何变量名称,它在该else
语句中似乎未定义。
最重要的是,确切的代码适用于我的 friend ...... 任何帮助将不胜感激。
最佳答案
既然您提到它适用于您的 friend 但不适用于您,那么这可能不是代码本身的问题。尝试运行meteor Reset
。
关于javascript - 在 Meteor 中,FS.Store.GridFS TransformWrite 函数中未定义 Images 集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31009725/