GUN — primary keys in decentralized databases
This is a short article on how to translate the concept of primary keys from classical relational databasesystems like MySQL, into decentralized graph databases, such as GUN.
Short prefase about GUN
Gun is a decentralized peer-to-peer database system, that allow you to store information right there on the device, and then synchronize that information with others. It is really cool, because you don’t really need a server to create your app :)
This is just a short article because I just realized something (took me awhile, and perhaps it is just super obvious to you) but I think this will save you a lot of time down the road if you are just starting out using gun and decentralized graph databases.
Primary keys
In a classical database structure we usually have a table with information like first name, last name, phone, etc. To make sure that we have a way to uniquely identify a data entry we may give everything a unique ID. In SQL and the like you can auto-increment the key to make sure every item is automatically assigned an ID. This is what I did when first learning programming, but there are a lot of times when this is actually bad practice.