Fix main field set to id on mongo

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
Alexandre Bodin 2020-01-27 09:53:19 +01:00
parent 1106c07795
commit d0c26fef67

View File

@ -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';