使用以下集合;
var imageStore = new FS.Store.S3("images", { bucket: "my-bucket" });
Images = new FS.Collection("images", { stores: [imageStore] });
Images.allow({ insert: function () {
return true;
}, update: function () {
return true;
}, remove: function () {
return true;
}, download: function () {
return true;
} });
我可以成功存储和上传图像到S3 - 图像上传很好,并保存在Mongo DB中。
但是当我这样做的时候;
Images.find().count()
它将返回0
Images.find().fetch()
返回一个空数组。
如果我运行meteor mongo
并使用查询db.cfs.images.filerecord.find().count()
,则会返回6(正确的数字)
想知道我在这里做错了什么?
答案 0 :(得分:1)
如果您已删除自动发布,请不要忘记发布您的images
收藏集。
服务器强>:
Meteor.publish("images", function() {
return Images.find(); //Narrow this down to the images that should be viewable
});
然后在客户端:
Meteor.subscribe("images");