Closed sajadghawami closed 3 years ago
Hey there,
so i migrated to v9 and everything works fine expect the nested relationship created with getFieldOTC and addResolver:
v9
getFieldOTC
addResolver
VendorTC.getFieldOTC('shop').addRelation('shopAddress', { resolver: () => ShopAddressTC.mongooseResolvers.findById(), prepareArgs: { _id: (source: IShop) => source.shopAddress, }, projection: { shopAddress: true }, });
When querying, shopAddress will be null.
shopAddress
null
This is the code from an earlier version that definately worked:
VendorTC.getFieldOTC('shop').addRelation('shopAddress', { resolver: () => ShopAddressTC.getResolver('findById'), prepareArgs: { _id: (source: IShop) => source.shopAddress, }, });
As you can see, i changed to the new mongooseResolvers and added the projection that was missing from before (still worked without the projection).
mongooseResolvers
At some other point i have the following:
ShopTC.addRelation('shopAddress', { resolver: () => ShopAddressTC.mongooseResolvers.findById(), prepareArgs: { _id: (source: any) => source.shopAddress, }, });
And it seems that when i remove that part, everything works as expected.
Anyone solved this yet ?
I found out that adding:
projection: { shopAddress: true },
To both relationships will make it work. I am not sure why though, but i will just leave this here!
Hey there,
so i migrated to
v9
and everything works fine expect the nested relationship created withgetFieldOTC
andaddResolver
:When querying,
shopAddress
will benull
.This is the code from an earlier version that definately worked:
As you can see, i changed to the new
mongooseResolvers
and added the projection that was missing from before (still worked without the projection).At some other point i have the following:
And it seems that when i remove that part, everything works as expected.
Anyone solved this yet ?