mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04:00
added API for removing collection fields
This commit is contained in:
parent
0a328034ff
commit
f39e6b8626
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue