Due to a bug in our app a bunch of relations are missing for users whom have uploaded photos to our parse server. The photos are uploaded and exists in our Parse server, they also have the pointer to the user's account. However, there was no relation set between the users account and the photo added. This affected a lot of users.
For the users that have an account and login into the app, I can do a query when they login into the app that relates the images to the accounts... but how can I do this using cloud code for all users?
So far I am writing a function that loops to all users and then relates photo with the same objectId
and user
in the photos
table. However, I think this will put a lot of pressure on the server since we have 30k users and 41.9k photos.
Is there a good way to add missing relationships?
One of the Parse.com features missing in Parse server is the background jobs
in which you could schedule a task/function to be executed periodically, like a cron job on Linux. I suggest to write a job function scheduled to be executed over a defined period of time (let's say every hour) to go through a subset of your data and fix the relationships.
Kue can be used to implement a similar functionality as Parse.com background jobs.
How to get Parse Background Job functionality on Parse Server