How can you make use of populate functionality of mongoose to improve performance with graphql?
@YourTechBudCodes3 жыл бұрын
Interesting question. We'll I haven't used Mongoose at all, but I guess populate is a feature to manage relationships. If I'm not wrong the same question can be extended for SQL joins. We don't want to GraphQL server to join the data when the driver/db can do it in an optimised manner. There is no easy answer here. The way we handled this problem in SpaceCloud is that we took control of the "Planning" step. Think of it as looking down the entire query tree then firing join queries upfront. In other words, you fire a different query to retrieve the posts when the author field is asked in its selection set vs when it isn't. This way we delegate the responsibility of joining data to the underlying database wherever possible. Hope that answers your question.
@khaled_osman3 жыл бұрын
@@YourTechBudCodes so then when creating items in mutations you still need communication between the microservices to store the id references/relationships across the databases & microservices correct? federation will only handle the querying part and redirect it to to the corresponding microservice, but for mutations you need to handle that yourself
@YourTechBudCodes3 жыл бұрын
Thats right. You need to handle that piece yourself. However, the mode of communication can be event driven or synchronous based on the requirement.
@MeenakshiSekar3 жыл бұрын
Explained in a simple terms which made us to realize why graphql
@YourTechBudCodes3 жыл бұрын
Glad you liked it
@sureshvadapalli82512 жыл бұрын
Thank you, Very Nicely explained. One question related to the orchestration pattern you explained... I have two different Microservices Customers and Products and each have a different database. I have a work flow orchestration layer that exposes one API endpoint and aggregates the response and returns it to the front end. If I use GraphQL to implement this use case, I still have to call the two underlying APIs and aggregate the result. correct? How does it help?
@YourTechBudCodes2 жыл бұрын
Glad you liked the video. That is correct. Graphql provides you with the mechanism to join the results of the different endpoints together. All you need to do is write the logic to call each endpoint individually and not worry about stitching at all. This becomes even easier when using tools like SpaceCloud which will let you do all this without writing a single line of code.
@alialsubaie85293 жыл бұрын
Thank you 💗, keep it up buddy 👍
@YourTechBudCodes3 жыл бұрын
Glad you liked it!
@jasonalinton3 жыл бұрын
Incredible video
@YourTechBudCodes3 жыл бұрын
Glad you liked it!
@subrahmanyagurumurthy50833 жыл бұрын
Thank you!
@YourTechBudCodes3 жыл бұрын
Glad you liked it!
@Nilesh_Narkhede3 жыл бұрын
Insightful..
@YourTechBudCodes3 жыл бұрын
Thanks buddy
@ayoadeabolaji93393 жыл бұрын
Interesting... "GraphQL is to API Servers what SQL is to Databases"