Vulcan/packages/telescope-lib/lib/collections.js

14 lines
332 B
JavaScript
Raw Normal View History

2015-04-24 09:28:50 +09:00
/**
* Add an additional field to a schema.
* @param {Object} field
*/
Meteor.Collection.prototype.registerField = function (field) {
var collection = this;
var fieldSchema = {};
fieldSchema[field.propertyName] = field.propertySchema;
// add field schema to collection schema
collection.attachSchema(fieldSchema);
}