mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Merge pull request #5100 from strapi/fix/main-field-exclude-id
Fix main field set to id on mongo
This commit is contained in:
commit
3c59a05154
@ -30,7 +30,9 @@ function createDefaultMainField(schema) {
|
||||
if (!schema) return 'id';
|
||||
|
||||
const mainField = Object.keys(schema.attributes).find(
|
||||
key => schema.attributes[key].type === 'string' && key !== schema.primaryKey
|
||||
key =>
|
||||
schema.attributes[key].type === 'string' &&
|
||||
!['id', schema.primaryKey].includes(key)
|
||||
);
|
||||
|
||||
return mainField || 'id';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user