I suggest you look at your error log, I suspect you will find a transacion buffer error (probably says warning but my experience is that it stops doing updates once you hit the warning). If I am correct then you problem is that your javascript is trying to do all the updates in one transaction and running out of transaction buffer space. You need to split it into multiple transactions.
Now, I have had this problem, but never found a way to split a single javascript execution into multiple transactions. I think you can do wthis by executing actions against each record because I believe (only from what I have read) that each action runs in a discrete transaction.
When I encountered this issue, in the end, I wrote a PHP script and did it via CMIS because each CMIS update is executed in a single transaction.