I am using Couchbase Lite database for project which is schemaless as I know, and I am very happy with that one because it solves my issues, but it raise me one question related with primary key contraints in NoSQL (Document Database).
As we all know that all Schema Database will be represented in tables, and these tables may or may not have primary/forgien key. For example lets suppose I have a table called Student which has the the primary key as usn(University seat number), along with other attributes, firstname, lastname, address, contactnumber, etc etc.
usn | firstname | lastname | address | contactnumber
2BA11CS409 | abc | mnq | Bangalore | 1234567890
2BA11CS410 | xyz | PQR | Mumbai | 1234567809
Here the table will through an error saying that violation of primary key constraints (cannot added duplicate key) if I tried to add 2BS11CS409 value once again.
But what is the case in Document Database, how it will identify unique value within document,
docID:123456789zxcv
{
usn : 2BA11CS409,
firstname : abc,
.......
....... etc
}
I know each document has one unique Id whose key is indexed for searching in database, but what I created another document with same values as above,
docID:zxcv123456789
{
usn : 2BA11CS409,
firstname : abc,
last
....... etc
}
when I try to access one database with usn, it has to return me just one document, but it will return me two document may be identical or different.
I need to know primary/unique key kind of concept in document database, which is exist in Relational database. OR you can redirect me to some articles
Thank You.