-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference between .getAll() and .each()? #85
Comments
Or maybe I just don't know how to properly use the .each() method... |
|
Oh...I guess the syntax is
I was calling
My bad! |
What if I need to do async stuff within the .each loop? Specifically, changing and upserting the modified records as I go.
|
Yes that is the idea. When you open the store you get a transaction so you should launch all your tasks there. I honestly haven't touched this codebase in quite a few years so I hope that all works! |
So getting back to this and digging in a bit more, I'm able to attach to the $q.notify events for the .each() function as follows:
I'm still stuck on how to do anything asynchronously within that loop. In my use case, many of the records are dependent on each other, and updates made to one record need to be saved back to indexedDb to be available when other records are processed. Is it possible to do async jobs within the openCursor lifecycle in IndexedDB? |
Can someone explain the difference between these 2 methods? They both seem to return an array of all items in the object store. For a very large set of records, I was hoping for a way to iterate through them in a way that didn't require them all being held in memory at the same time, which is what I though .each() would do. Any ideas?
The text was updated successfully, but these errors were encountered: