What is Exactly index in indexedDB
Database has always been a must-have in web development. It is usually located on the web server and using it is a required skill for back-end developers. Things have now been changed, because front-end developers are now having a localized database called indexedDB in the browser side.
indexedDB is now the only recommended database standard by the W3C. WebSQL, as an alternative, is only supported by some browsers, like Google Chrome. Knowing how to use indexedDB can bring front-end developers more possibilities when dealing with complex data in the client side, thus creating more diverse application use scenarios. However, what is exactly index in the indexedDB?
Before digging into the ins and outs of index, we need to know the basics of how indexedDB works. indexedDB is a window object. It is a type of NoSQL database. This means, you can store JavaScript objects inside indexedDB.
To use indexedDB, you need first to create a database by the following code:
Like SQL type databases, you then need to create a table and the different fields in the table of the database. It is called store
in indexedDB.
From the above code we can see that the index of each field is created. This is used for later query as query is the most important function of a database. Just remember, it is compulsory to set index as the first parameter of createIndex()
method.
Performing CRUD operations for indexDB is easy. It is all about how to use the APIs.
It is already obvious that the index in indexedDB is a query tag for search. You must manually create them for later use. The index can also be clearly seen in the browser developer tools under the Application section for Google Chrome. It is of course in other browsers as well, but the section name may be different.