简体   繁体   中英

Is it possible to check the id exists from one service to another in apollo-server with graphql?

I am stuck in the following problem, has anyone faced the same?

I have got two services using apollo-server with graphql using mongodb:

  1. Group service
  2. User service

Group service contains “users” which will be resolved from User service. Need to pass user while creating group, is it possible to check whether that user exist or not in User service before creating group in Group Service? or any other way?

If each micro-service has its own mongo database, I would recommend storing a users in the Group service as well. It does not need to have all the user information (in fact it probably should not), just the ID would be sufficient.

Otherwise the solution would be to call the Users micro-service from the Ground micro-service, although ideally micro-services should not rely on each other.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM