0

I'm rather new to Telescope and Meteor.

I've added a custom field as such:

Users.addField({
    fieldName: 'apiToken',
    fieldSchema: {
        type: String,
        autoform: {
            group: 'API Token',
            label: 'Token'
        },
        optional: true,
        editableBy: ["member", "manager", "admin"]
    }
});

I got the field to appear in the User settings, but whenever I try to enter something and submit, it gives me the error "apiToken is not allowed by the schema".

I'm not sure if this is a Telescope or Meteor issue.

Do I need to edit the schema in MongoDB?

Naoto Ida
  • 1,275
  • 1
  • 14
  • 29

1 Answers1

0

I solved it thanks to Sacha.

When adding a new field to Telescope, you must declare it on both the client and server.

package.js

Package.onUse(function (api) {
    // client
    api.addFiles([
        "strawberry_fields.js"
    ], "client");

    // server
    api.addFiles([
        "strawberry_fields.js"
    ], "server");
}

strawberry_fields.js

Users.addField({
    fieldName: 'Likes strawberries',
    fieldSchema: {
        type: String,
        autoform: {
            group: 'Strawberries',
            label: 'Strawberries'
        },
        optional: true,
        editableBy: ["member", "manager", "admin"]
    }
});
Community
  • 1
  • 1
Naoto Ida
  • 1,275
  • 1
  • 14
  • 29