Skip to content

Commit

Permalink
Merge pull request #7036 from strapi/fix/mongooseReservedWords
Browse files Browse the repository at this point in the history
add more reserved words to the list
  • Loading branch information
alexandrebodin committed Jul 16, 2020
2 parents e2323aa + fc69e48 commit 9567fb4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion packages/strapi-database/lib/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9567fb4

Please sign in to comment.