我正在开发流星后端,现在我正在尝试以某种方式将文本文件与图像相关联。有没有一种方法来存储文本文件fscollection
?如何将它们关联到两个不同的集合中?
这是我的两个收藏:
Images = new FS.Collection("Images", {
stores: [new FS.Store.FileSystem("Images", {path: "~/padonde/uploads"})]
});
Reynosa = new Mongo.Collection("Reynosa");
在FsCollection中,我存储图像,在其他集合中存储数据,但是它们都将是同一条记录的一部分。
您可以像这样在FSCOllection内部使用元数据
在同一个FSCollection中,您应该使用以下插入函数:
Template.templateName.events({
'click #clickEvent' : function(){
var file = $('#addImagenPromocion').get(0).files[0]; // Stores temporaly the FSFile
var fsFile = new FS.File(file); // take the FS.File object
fsFile.metadata = {nameValueMetadata:"Cool Stuff"};
Images.insert(fsFile);
}
});
因此,在此之后,如果运行,则在FSCollection上插入一些元数据 Images.find().fetch();
然后您将获取nameValueMetada:"cool stuff"
文档中的值
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句