mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge pull request #7400 from strapi/fix/database-fixes
Fix virtual mongoose remove _v char
This commit is contained in:
commit
e25a508b2b
@ -115,11 +115,9 @@ module.exports = ({ models, target }, ctx) => {
|
|||||||
|
|
||||||
// Add virtual key to provide populate and reverse populate
|
// Add virtual key to provide populate and reverse populate
|
||||||
_.forEach(
|
_.forEach(
|
||||||
_.pickBy(definition.loadedModel, model => {
|
_.pickBy(definition.loadedModel, ({ type }) => type === 'virtual'),
|
||||||
return model.type === 'virtual';
|
|
||||||
}),
|
|
||||||
(value, key) => {
|
(value, key) => {
|
||||||
schema.virtual(key.replace('_v', ''), {
|
schema.virtual(key, {
|
||||||
ref: value.ref,
|
ref: value.ref,
|
||||||
localField: '_id',
|
localField: '_id',
|
||||||
foreignField: value.via,
|
foreignField: value.via,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user