我需要以某种方式objectId从@Args警卫内部访问,以便检查发件人是否已objectId分配给他的帐户。知道我如何实现它吗?
@Query(() => [Person])
@UseGuards(ObjectMatch)
async pplWithObject(@Args('objectId') id: string): Promise<Person[]> {
return await this.objService.getPeopleWithObject(id);
}
Run Code Online (Sandbox Code Playgroud)
是否可以从上下文访问传递的参数?
const ctx = GqlExecutionContext.create(context);
const request = ctx.getContext().req;
Run Code Online (Sandbox Code Playgroud) 我有以下基本代码片段,我的目标是从 获取 fullDocument 属性,obj: ChangeEvent但是我无法访问此属性 ( Property 'fullDocument' does not exist on type 'ChangeEvent<any>')。我可以访问的唯一属性是 _id、clusterTime 和 operationType。有什么我遗漏的,还是我应该非直接查询 fullDocument ( obj['fullDocument'])?
const changeStream = this.model.watch([], { fullDocument: 'updateLookup' })
.on('change', obj => {
console.log(obj.fullDocument);
});
Run Code Online (Sandbox Code Playgroud)