Database Reference
In-Depth Information
“Edward Scis-
sorhands 1 ” ] }
different data types as values and even contain other
arrays.
Globally
Unique
Id
Can be used as the primary key value for records and
documents. An object id is a 12-byte surrogate key for
documents.
{ orderId : ObjectId( )
}
R ELATIONSHIPS
Many such rules can be visually captured on our data model through relationships. A rela-
tionship is displayed as a line connecting two entities that captures the rule or navigation
path between them. If the two entities are Employee and Department , the relationship can
capture the rules “Each Employee must work for one Department ” and “Each Depart-
ment may contain one or many Employees .”
In a relationship between two entities, cardinality captures how many instances from one
entity participate in the relationship with instances of the other entity. It is represented by
the symbols that appear on both ends of a relationship line. It is through cardinality that
the data rules are specified and enforced. Without cardinality, the most we can say about
a relationship is that two entities are connected in some way through a rule. For example,
Employee and Department have some kind of relationship, but we don't know more than
this.
For cardinality, we can choose any combination of zero, one, or many. Many (some people
read it as more ) means any number greater than zero. Specifying zero or one allows us to
capture whether or not an entity instance is required in a relationship. Specifying one or
many allows us to capture how many of a particular instance participates in a given rela-
tionship.
Because we have only three cardinality symbols, we can't specify an exact number [4] (other
than through documentation), as in “A Car contains four Tires .” We can only say, “A Car
contains many Tires .” Each of the cardinality symbols is illustrated here with Author and
Title :
Search WWH ::




Custom Search