Merge pull request #7400 from strapi/fix/database-fixes

Fix virtual mongoose remove _v char
This commit is contained in:
Alexandre BODIN 2020-08-10 16:55:20 +02:00 committed by GitHub
commit e25a508b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,11 +115,9 @@ module.exports = ({ models, target }, ctx) => {
// Add virtual key to provide populate and reverse populate
_.forEach(
_.pickBy(definition.loadedModel, model => {
return model.type === 'virtual';
}),
_.pickBy(definition.loadedModel, ({ type }) => type === 'virtual'),
(value, key) => {
schema.virtual(key.replace('_v', ''), {
schema.virtual(key, {
ref: value.ref,
localField: '_id',
foreignField: value.via,