How do you iterate over records using a cursor in IndexedDB?
Ask by Rana Sunny
Updated 03 Jul 2025
You can iterate over records in IndexedDB using a cursor, which allows you to go through each record one-by-one—great for large datasets or conditional processing.
Basic Syntax for Cursor Iteration
You Can Use Cursor With:
store.openCursor()index.openCursor()store.openCursor(IDBKeyRange.bound(1, 100))store.openCursor(null, 'prev')Example: Read All Users Where Age > 30
Cursor Methods
cursor.continue()cursor.advance(n)nrecordscursor.update(value)cursor.delete()Update Record During Iteration
Summary