Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @param {String} fieldName
*/
Mongo.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});
};
/**
* @summary Global schemas object. Note: not reactive, won't be updated after initialization
*/
SimpleSchema.prototype.getProfileFields = function () {
var schema = this._schema;
var fields = _.filter(_.keys(schema), function (fieldName) {
var field = schema[fieldName];
return !!field.profile;
});
return fields;
};
/**
* @summary Get a list of a schema's private fields
*/
Mongo.Collection.prototype.getPrivateFields = function () {
var schema = this.simpleSchema()._schema;
var fields = _.filter(_.keys(schema), function (fieldName) {
var field = schema[fieldName];
return field.publish !== true;