Skip to content

Commit

Permalink
Merge pull request #5100 from strapi/fix/main-field-exclude-id
Browse files Browse the repository at this point in the history
Fix main field set to id on mongo
  • Loading branch information
alexandrebodin committed Jan 27, 2020
2 parents bd86969 + d0c26fe commit 3c59a05
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 3c59a05

Please sign in to comment.