5.3 KiB
cfs-collection Public API
CollectionFS, FS.Collection object
API documentation automatically generated by docmeteor.
fsCollection.insert(fileRef, [callback]) Anywhere
This method insert is defined in prototype
of FS.Collection
Arguments
File data reference
- callback {function} (Optional)
Callback function(error, fileObj)
Returns {FS.File}
The file object
Meteor docs
FS.Collection.prototype.insert = function(fileRef, callback) { ...
api.common.js:8
fsCollection.update(selector, modifier, [options], [callback]) Anywhere
This method update is defined in prototype
of FS.Collection
Arguments
- selector {FS.File|object}
- modifier {object}
- options {object} (Optional)
- callback {function} (Optional) Meteor docs
FS.Collection.prototype.update = function(selector, modifier, options, callback) { ...
api.common.js:71
fsCollection.remove(selector, [callback]) Anywhere
This method remove is defined in prototype
of FS.Collection
Arguments
- selector {FS.File|object}
- callback {Function} (Optional) Meteor docs
FS.Collection.prototype.remove = function(selector, callback) { ...
api.common.js:92
fsCollection.findOne(selector) Anywhere
This method findOne is defined in prototype
of FS.Collection
Arguments
- selector {selector}
Meteor docs Example:
var images = new FS.Collection( ... );
// Get the file object
var fo = images.findOne({ _id: 'NpnskCt6ippN6CgD8' });
FS.Collection.prototype.findOne = function(selector) { ...
api.common.js:122
fsCollection.find(selector) Anywhere
This method find is defined in prototype
of FS.Collection
Arguments
- selector {selector}
Meteor docs Example:
var images = new FS.Collection( ... );
// Get the all file objects
var files = images.find({ _id: 'NpnskCt6ippN6CgD8' }).fetch();
FS.Collection.prototype.find = function(selector) { ...
api.common.js:138
fsCollection.allow(options) Anywhere
This method allow is defined in prototype
of FS.Collection
Arguments
-
options {object}
- download {function}
Function that checks if the file contents may be downloaded
- insert {function}
- update {function}
- remove {function}
Functions that look at a proposed modification to the database and return true if it should be allowed
- fetch {[string]} (Optional)
Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions
Meteor docs Example:
var images = new FS.Collection( ... );
// Get the all file objects
var files = images.allow({
insert: function(userId, doc) { return true; },
update: function(userId, doc, fields, modifier) { return true; },
remove: function(userId, doc) { return true; },
download: function(userId, fileObj) { return true; },
});
FS.Collection.prototype.allow = function(options) { ...
api.common.js:164
fsCollection.deny(options) Anywhere
This method deny is defined in prototype
of FS.Collection
Arguments
-
options {object}
- download {function}
Function that checks if the file contents may be downloaded
- insert {function}
- update {function}
- remove {function}
Functions that look at a proposed modification to the database and return true if it should be denyed
- fetch {[string]} (Optional)
Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions
Meteor docs Example:
var images = new FS.Collection( ... );
// Get the all file objects
var files = images.deny({
insert: function(userId, doc) { return true; },
update: function(userId, doc, fields, modifier) { return true; },
remove: function(userId, doc) { return true; },
download: function(userId, fileObj) { return true; },
});
FS.Collection.prototype.deny = function(options) { ...
api.common.js:200