1. When New User Joins
- When New User Joins, he/she needs to signup it’s a regular process that everyone needs to follow
- Then now we’ll be fetching their “github_user_id” field as well.
- Let suppose if user changes their GitHub Username for some reason, login back to the RDS Site, then no new document will get created! Hence the bug has been fixed!
- For more clarification please refer the attached video:
2023-04-24 21-31-14.mp4
2. Migration Part
- I’ve created a post route:
- Initially the route was
router.patch("users/api/migrate", users.migrate);
This is the updated one, I’ve added the addition security as well

- and created a function called migrate, this function will loop over all documents present inside the user collection of RDS and based on the “github_id”(which stores the username) of all the documents it will fetch “github_user_id”(which will store the unique id) field accordingly.
- Super user just need to run this route once!
- For more clarification please refer the attached video:
- Instead of updating each user one by one in a for loop, which can be inefficient when dealing with a large number of users in the database (more than 1000 users for our database). I used the batch update methodology you can see the below attached image, with this we can avoid rate limiting of Github Api.
Migration Explanation