javascript - 在 Meteor 中,FS.Store.GridFS TransformWrite 函数中未定义 Images 集合

标签 javascript meteor compilation scope collectionfs

/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/

相关文章:

javascript - 如何将自定义回调添加到 jquery 插件

javascript - 在父类中获取 "this"

javascript - 在 DDL 中查找 optgroup 的值

javascript - 当 css 样式为高度 : 100%; and overflow: scroll; 时检测滚动及其方向

javascript - 我正在尝试运行我的 meteor 应用程序,但它给出了一堆错误

javascript - 在 pathFor iron-router 中的查询中使用当前每个数据

javascript - 复用了 Meteor JS 中的部分代码

c++ - 具有正确链接库的 undefined reference

gcc - 为什么 Go 源码包含很多 .go 文件?它们是如何编译的?

parsing - 将 C 类型语法编译为自定义程序集