Drop the following into a plugin or in your schema:
schema.method({
fieldProperties:
function (fieldName, propertyName) {
fieldRef = schema.path(fieldName);
if (fieldRef.options[propertyName]) {
return fieldRef.options[propertyName];
}
return;
},
});
Then you can use it with:
someRecord.fieldProperties('fieldName', 'enum'));
You can use it for most options of a field - just keep in mind that
you may need to use the result as a function if the property is a
function - ie a calculated default.
It'll return undefined if the property doesn't exist.
Dasher