如何将集合中的文本文件与fs集合中的图像相关联?

我正在开发meteor的后端,现在我试图用某种方式将文本文件与图像关联起来。 有没有办法在fscollection存储文本文件? 我怎样才能把他们在两个不同的集合?

这是我的两个集合:

 Images = new FS.Collection("Images", { stores: [new FS.Store.FileSystem("Images", {path: "~/padonde/uploads"})] }); Reynosa = new Mongo.Collection("Reynosa"); 

在FsCollection中,我存储图像和其他集合存储数据,但是它们都是同一个logging的一部分。

您可以像这样在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();

你会在文件里面inputnameValueMetada:"cool stuff"

Interesting Posts