Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
ICSM Computer
01-Jul-2025In IndexedDB, a
keyPathis a property (or path) within your stored object that serves as its primary key — a unique identifier for each record.What is
keyPath?How
keyPathis UsedExample: Simple KeyPath
Now, when you store an object like this:
IndexedDB uses
101(fromid) as the primary key.Example: Nested KeyPath
Here, the object:
Will be stored with
999as the key.Example: Compound KeyPath
Now the combination of
firstNameandlastNameis the unique key.Without
keyPath(Manual Keys)If you don’t use a
keyPath, you must pass the key manually:Summary
keyPathadd()orput()