【问题标题】:In Meteor, the Images collection is undefined in the FS.Store.GridFS transformWrite function在 Meteor 中,图像集合在 FS.Store.GridFS transformWrite 函数中未定义
【发布时间】:2015-06-23 17:39:22
【问题描述】:

/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 声明中,但没有成功。

但是重要的是,不只是Images 会因为未定义而导致错误。如果我包含 any 变量名称,它似乎在 else 语句中未定义。

最重要的是,确切的代码适用于我的朋友...... 任何帮助将不胜感激。

【问题讨论】:

    标签: javascript meteor compilation scope collectionfs


    【解决方案1】:

    由于您提到它适用于您的朋友但不适用于您,这可能不是代码本身的问题。尝试运行meteor reset

    【讨论】:

      猜你喜欢
      • 2014-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-01
      • 2017-05-01
      • 1970-01-01
      • 2013-07-10
      • 2015-03-08
      相关资源
      最近更新 更多