In my Parse database, I have a "Connection" class that unites two users. In one of my methods, I try to find all the users that the person is connected to. However, I am stuck between two different options, none of which seem very effective.
My first reaction was to constantly query db until all objects were returned (for example, "query first 1000, query second 1000, ..."). In most cases, this would be ideal, as most users would have less than 1000 connections (probably more than 2-300 or so). However, if a user has an insane amount of connections, this will not work too well, especially because Pars has break limits.
Another option seems to be to use the Query.each method to simply iterate over all the records matching the query. I believe that this will work regardless of the number of elements, so this is good. However, it seems like it's relatively slow for large sizes and probably a wait time.
So what would be the best way to do this with Parse restrictions? I want this to be fast in the general case of a relatively small number of objects, but of course it should not break for edge cases. Of course, one of the options would be to simply not fulfill this type of request, but it is very useful to have all connections on the client side. Thank!
source
share