From fc69e48009cbdad6d9f4fb744bbb424771e1f2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20No=C3=ABl?= Date: Thu, 16 Jul 2020 16:11:54 +0200 Subject: [PATCH] add more reserved words to the list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Noël --- .../strapi-database/lib/constants/index.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/strapi-database/lib/constants/index.js b/packages/strapi-database/lib/constants/index.js index da41612ee4..0c35372979 100644 --- a/packages/strapi-database/lib/constants/index.js +++ b/packages/strapi-database/lib/constants/index.js @@ -3,7 +3,37 @@ // contentTypes and components reserved names const RESERVED_MODEL_NAMES = ['admin', 'boolean', 'date', 'date-time', 'time', 'upload']; // attribute reserved names -const RESERVED_ATTRIBUTE_NAMES = ['_id', 'id', 'length', 'attributes', 'relations', 'changed']; +const RESERVED_ATTRIBUTE_NAMES = [ + '_id', + 'id', + 'length', + 'attributes', + 'relations', + 'changed', + 'created_by', + 'updated_by', + '_posts', // list found here https://mongoosejs.com/docs/api.html#schema_Schema.reserved + '_pres', + 'collection', + 'emit', + 'errors', + 'get', + 'init', + 'isModified', + 'isNew', + 'listeners', + 'modelName', + 'on', + 'once', + 'populated', + 'prototype', + 'remove', + 'removeListener', + 'save', + 'schema', + 'toObject', + 'validate', +]; module.exports = { RESERVED_MODEL_NAMES,