我有一个关于别名的问题。可以在嵌入对象内的变量上使用别名吗?我知道我也可以做一个虚拟get来实现这一点,然而,graphql在执行此方法时看不到该变量。如果你有办法让虚拟作品,请让我知道!例如,我是这样想的:
export class Embedded {
@prop({nullable: false}, alias: "Parent.testName")
name: string; // Variable I want to get
}
export class Parent {
@prop({nullable: false})
ObjectWithName: Embedded;
testName: string
}发布于 2020-06-27 23:22:15
参考:
如果没有一个虚拟的getter,这是不可能的,here is the documentation如何使用mongoose提供的别名
https://stackoverflow.com/questions/62602930
复制相似问题