Fork me on GitHub
This API is deprecated since version 1.3.0 and no longer available since version 1.3.1

CollectionFS

CollectionFS works a bit different from regular Meteor.Collection object, and in order to use these special collections we need to use $meteorCollectionFS (or $meteor.collectionFS). The API is the same of $meteor.collection, the only difference is the handling of this collection behind-the-scenes.


$meteor.collectionFS has been deprecated in favor of of using the regular CollectionFS package.

No need for special wrapper anymore, the new helpers API let's us use the regular Meteor API.

you can just create a helper for your collection that returns a cursor, just like any other collection.

Here is an example for how to migrate:

Old code:

angular.module(`myApp`, []).controller(`MyCtrl`, function($scope) {
  $scope.myImages = $scope.meteorCollectionFs(Images);
  $scope.subscribe(`images`);
  $scope.myImages.save({});
  $scope.imageUrl = $scope.myImages[0].url();
});

New code:

angular.module(`myApp`, []).controller(`MyCtrl`, function($scope) {
  $scope.subscribe(`images`);
  $scope.helpers({
    myImages() {
      return Images.find({});
    },
    imageUrl() {
      return $scope.myImages[0].url();
    }
  });
  // This is the original Meteor API for using CollectionFS
  Images.insert({});
});

Usage

$meteor.collectionFS(Images, false);

// Or in case you want a different query
$meteor.collectionFS(function() {
  return Images.find();
}, false);