sql >> Base de Datos >  >> NoSQL >> MongoDB

meteorito sube un archivo a mongodb

Está buscando el FSCollection Package y el GridFS Adaptador de almacenamiento.

para comenzar, ejecute esto en la consola.

meteor add cfs:standard-packages

meteor add cfs:gridfs

ahora con fsCollection puede cargar archivos tan simple como.

Primero

Declarar la Colección.

AudioCollection = new FS.Collection("AudioCollection", {
  stores: [new FS.Store.GridFS("AudioCollection")]
});

Cree un Event handler simple .

Template.example.events({
  'click #example':function(e,t){
    //Simple Event to upload files into mongo.
  }
})

Y haz un simple helper

Template.example.helpers({
 showAudio:function(){
   return AudioCollection.find();
  }
})

Con este HTML

{{each showAudio}}
  {{#if isAudio}}
   <!-- show whatever you want here -->
  {{/if}}
{{/each}}

Dado que el LÉAME está vacío en este momento, hice una muestra DEMO .