I have seen this "label" usage quite a few times in meteor simple schema. Just have no idea why do we need such a field.
const Product = new SimpleSchema({ _id: {
type: String,
label: "Product ID" } })
Thanks
Derek
IMO label is a readable name of the field, it helps the code more semantic. It also helps when debugging, for example if you have a schema field like:
// ...
appId: {
type: String,
},
// ...
Then if you do not provide the appId
value when inserting you will get this error Error: App id is required
. It could be hard to know what is wrong because SimpleSchema re-format the field name automatically. In case you provide a label field:
// ...
appId: {
type: String,
label: 'App Id of the document',
},
// ...
Then the error message will be: Error: App Id of the document is required
, it is easier to find the problem with this message.