1

I am testing Parse.com as a backend for one of my iOS apps and I have a question concerning the CloudCode feature with the "afterDelete" trigger.

My app has a list of albums and each album has a list of pictures. An album can contain hundreds or thousands of pictures. When the user deletes an album, all its pictures will be deleted too.

I am following the sample found on the Parse.com guide (https://parse.com/docs/cloudcode/guide#cloud-code-afterdelete-triggers) with the "destroyAll" functions. However, when I use it, only the first 100 children (pictures) get deleted. Is there a way to really delete ALL children of an object in ONE query?

Thanks

Nasedo47
  • 337
  • 3
  • 13
  • 2
    No, queries max out at 1000 items – Wain Jan 12 '16 at 20:34
  • [See this link](https://stackoverflow.com/questions/33476587/delete-objects-inparse-after-a-set-amount-of-time-from-a-specific-class/33481996#33481996). The gist is that you cannot use `find` + `destroyAll`, instead you should use `each` and `destroy`. – Russell Jan 12 '16 at 20:39
  • @Russell I have tested this code with `each`, but I still have the same results. Only the first 100 records got deleted. – Nasedo47 Jan 12 '16 at 21:20
  • 1
    is the `afterDelete` trigger's 3sec timeout occurring or is it 100 on the dot? [Per this post by Parse's Hector Ramos](https://parse.com/questions/background-job-remove-all-objects-for-user), using Parse.Query's each() instead of find() will ensure that all objects get deleted. – Russell Jan 12 '16 at 21:28
  • I have tested with a background job and all my records were deleted, so I suppose it has something to do with the timeout too. But I see as well as there is a lot of API requests that were made, so if I have several users deleting their records at the same time, I will easily reach the 30reqs/s limit... – Nasedo47 Jan 12 '16 at 21:46
  • Glad to hear it's working now! Unfortunately, there is no way to get around the number of requests you will generate by deleting objects. [See this link for more information regarding batch operations and the request limit](https://stackoverflow.com/questions/34651651/update-multiple-rows-conditional/34661382#34661382). It is applies directly to what you are doing except you are deleting instead of updating the objects. – Russell Jan 12 '16 at 22:45
  • Now that Parse Server is open source, this question became irrelevant as I can remove all those limitations myself :-) – Nasedo47 Mar 01 '16 at 06:59

1 Answers1

0

Now that Parse Server is open source, this question became irrelevant as I can remove all those limitations myself :-)

Nasedo47
  • 337
  • 3
  • 13