Move, rename and delete fields

When building your admin panel, you will probably want to hide as much complexity from your users as you can.

This includes:

  • Hiding technical and confidential fields

  • Using naming conventions that the final user understands.

Moving fields

You can import fields from single record relationships into your collections.

The imported fields will behave as if they were on that collection.

// Assuming the following structure:
// User    { id, firstName, lastName, addressId }
// Address { id, streetName, streetNumber, city, countryId }
// Country { id, name }

userCollection
  .importField('city', { path: 'address:city', readonly: true })
  .importField('country', { path: 'address:country:name', readonly: true });

Note that when using readonly: false, the related records will be updated.

Renaming and removing fields

Renaming and removing fields can be done simply by calling the renameField and removeFields methods.

collection.renameField('account_v3_uuid_new', 'account').removeField('password');

Last updated

Was this helpful?

Revision created

docs(datasource-sql): document introspection process