File tree 1 file changed +5
-4
lines changed
packages/db-mongodb/src/utilities
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,13 @@ export const buildVirtualFieldsAggregation = ({
37
37
}
38
38
39
39
if ( 'virtual' in field && field . virtual && typeof field . virtual === 'object' ) {
40
+ const relationshipPath = versions
41
+ ? `version.${ field . virtual . relationship } `
42
+ : field . virtual . relationship
40
43
const currentPath = `${ prefix } ${ field . name } `
41
44
const relationshipField = getFieldByPath ( {
42
45
fields : rootFields ,
43
- path : versions ? `version. ${ field . virtual . relationship } ` : field . virtual . relationship ,
46
+ path : relationshipPath ,
44
47
} )
45
48
46
49
if ( ! relationshipField ) {
@@ -81,9 +84,7 @@ export const buildVirtualFieldsAggregation = ({
81
84
as : currentPath ,
82
85
foreignField : '_id' ,
83
86
from : RelationshipModel . collection . name ,
84
- localField : versions
85
- ? `version.${ field . virtual . relationship } `
86
- : field . virtual . relationship ,
87
+ localField : relationshipPath ,
87
88
pipeline : [
88
89
{
89
90
$project : {
You can’t perform that action at this time.
0 commit comments