diff --git a/packages/telescope-lib/lib/collections.js b/packages/telescope-lib/lib/collections.js index 071067151..84215a19a 100644 --- a/packages/telescope-lib/lib/collections.js +++ b/packages/telescope-lib/lib/collections.js @@ -13,6 +13,19 @@ Meteor.Collection.prototype.registerField = function (field) { collection.attachSchema(fieldSchema); } +/** + * Remove a field from a schema. + * @param {String} fieldName + */ +Meteor.Collection.prototype.removeField = function (fieldName) { + + var collection = this; + var schema = _.omit(collection.simpleSchema()._schema, fieldName); + + // add field schema to collection schema + collection.attachSchema(schema, {replace: true}); +} + /** * Global schemas object * @namespace Telescope.schemas