在 Meteor 中,Images 集合在 FS.Store.GridFS transformWrite 函数中未定义
In Meteor, the Images collection is undefined in the FS.Store.GridFS transformWrite function
在/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
语句中未定义。
最重要的是,确切的代码适用于我的朋友...
任何帮助将不胜感激。
既然你提到它适用于你的朋友而不是你,那么这可能不是代码本身的问题。试试 运行 meteor reset
.
在/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
语句中未定义。
最重要的是,确切的代码适用于我的朋友... 任何帮助将不胜感激。
既然你提到它适用于你的朋友而不是你,那么这可能不是代码本身的问题。试试 运行 meteor reset
.