Skip to content

collection

dr.dimitru edited this page Apr 8, 2016 · 6 revisions
Meteor.Files.collection [Isomorphic]

Direct reference to Mongo.Collection

var Images = new Meteor.Files({collectionName: 'Images'});

// Example 1:
Images.collection.find({}).forEach(function (fileRef) {
  Images.link(fileRef);
});

// Example: Subscribe:
if (Meteor.isClient) {
  Images.collection.subscribe('files.images.all');
}

// Example: Publish:
if (Meteor.isServer) {
  Meteor.publish 'files.images.all', function () {
    Images.collection.find({});
  }
}
Clone this wiki locally