I would like to add some article attachments and these attachments that were associated with the article.
Hi I have created schema data in a form:
Docs = new SimpleSchema({ fileName: { type: String, label: "Tytuł załącznika", optional: true }, fileId: { type: String, label: "Nazwa pliku", autoform: { afFieldInput: { type: "cfs-file", placeholder: 'Prosze dodaj załącznika...', collection: "files" } }, optional: true } });
Schemas.Wydarzenie = new SimpleSchema({ ... docs:{ type: [Docs], label: "Załączniki", }, ... });
The package “aldeed:autoform” can save files in the array that is associated with the article by _id.
The data stored in the database schema for the “Schemas.Wydarzenie”:
{ "_id" : "re4RyFScYEAmSEnGB", "docs" : [ { "fileName" : "fsdfsdfsdfs f df fsf", "fileId" : "mkEjjc5zjQW2Fdzuu" }, { "fileName" : "khjkhjkhkhjkhjj", "fileId" : "YvtbaFT3e7EwgZwrf" } ] }
The data stored in the database schema for the “Docs”:
{ "_id" : "mkEjjc5zjQW2Fdzuu", "original" : { "name" : "kazimierz.pdf", "updatedAt" : ISODate("2015-10-13T11:46:37.370Z"), "size" : 64098, "type" : "application/pdf" }, "uploadedAt" : ISODate("2016-02-09T06:46:08.910Z"), "copies" : { "files" : { "name" : "kazimierz.pdf", "type" : "application/pdf", "size" : 64098, "key" : "files-mkEjjc5zjQW2Fdzuu-kazimierz.pdf", "updatedAt" : ISODate("2016-02-09T06:46:08Z"), "createdAt" : ISODate("2016-02-09T06:46:08Z") } } } { "_id" : "YvtbaFT3e7EwgZwrf", "original" : { "name" : "porąbka.pdf", "updatedAt" : ISODate("2015-10-13T11:46:42.075Z"), "size" : 72654, "type" : "application/pdf" }, "uploadedAt" : ISODate("2016-02-09T06:46:09.208Z"), "copies" : { "files" : { "name" : "porąbka.pdf", "type" : "application/pdf", "size" : 72654, "key" : "files-YvtbaFT3e7EwgZwrf-porąbka.pdf", "updatedAt" : ISODate("2016-02-09T06:46:09Z"), "createdAt" : ISODate("2016-02-09T06:46:09Z") } } }
You are reset higher data schema can be used without installing a package “aldeed:autoform”.
If so can someone explain to me how to go about it.