i have an app with rest api in node js and mongodb as database. A user can login from multiple devices and i need to sync users all devices contacts in db more than 5000 contacts in each device.
Example: User A register from Device D1 and i save user contacts in mongo db. if same user login from another device D2 then i need to sync Device 1 and device 2 contacts in mongo db but contacts will be unique. if User A have number in D1 +xxx-xxx-xxx and same number without country code xx-xxx--xxx then previous number will be overwritten by new number.
At the same time i need to send the all existing contacts to app users.
my code is working fine at logical level but it takes approx 60 to 90 seconds. what should i do to increase the performance so that the sync is done quickly?
