I delt with Amazon Simple DB a while ago and I suspect that the BerkleyDB might be doing it somewhat similiar.
Both the Key and Value are BLOBS. Essentially you can store anything in there. Lets take a example based on some your points/questions listed.
The points I will cover is the following:
- How does it map emails to users?
- How are users related other users?
Like relational databases the key value must be unique so lets assume the user id/ user name is unique. Thus we can have a key value such as admin, jdoe, serviceadmin etc as keys. Since we can store anything in the value field we can store a XML document for example in the value field.
A example might look like this:
Key:
admin
Value:
<user>
<emaillist>
<email>admin@server.com</email>
</emaillist>
<relatedusers>
<relateduser>
<name>jdoe</name>
<relationship>someidentifier</relationship>
</relateduser>
<relateduser>
<name>serviceadmin</name>
<relationship>someidentifier</relationship>
</relateduser>
</relatedusers>
</user>
Since XML can be used to describe data in a variety of way this is probably a very simple example of what can be achieved. However you could store some binary format of data in there that is very similiar to XML that you can retrieve and intepret in some way. Like bit 1 is the active state of the user etc.
The power of NoSQL is that can store anything and the structure from row to row can also be different. This is also the down side. Since there is no way to intepret the data without proper documentation these type of databases are hard to understand from a structure point of view. They can literally contain anything.
Hope it makes sense to some extent now.