Databases Reference
In-Depth Information
the Civil War, you could search for those documents that referenced General Robert
E. Lee. The query would return a list of documents that contained his name.
A consequence of using a document store is everything inside a document is auto-
matically indexed when a new document is added. Though the indexes are large,
everything is searchable. This means that if you know any property of a document, you
can quickly find all documents with the same property. Document stores can tell not
only that your search item is in the document, but also the search item's exact loca-
tion by using the document path , a type of key, to access the leaf values of a tree struc-
ture, as illustrated in figure 4.21.
Even if a document structure is complex, a document store search API can remain
simple and provides an easy way to select a document or subset of a document. A key-
value store can store an entire document in the value portion of the key-value store,
but a document store can quickly extract subsections of a large number of documents
without loading each document into memory. If you want to display a single para-
graph of a book, you don't need to load the entire topic into RAM .
We'll begin our document store learning by visualizing something familiar: a tree
with roots, branches, and leaves. We'll then look at how document and application
collections use the document store concept and the document store API . Finally, we'll
look at some case studies and popular software implementations that use document
stores.
4.4.1
Document store basics
Think of a document store as a tree-like structure, as shown in figure 4.21.
Document trees have a single root element (or sometimes multiple root ele-
ments). Beneath the root element there is a sequence of branches, sub-branches, and
values. Each branch has a related path expression that shows you how to navigate
from the root of the tree to any given branch, sub-branch, or value. Each branch may
have a value associated with that branch. Sometimes the existence of a branch in the
tree has specific meaning, and sometimes a branch must have a given value to be
interpreted correctly.
Root
Branch
Branch
Figure 4.21 Document stores
use a tree structure that begins
with a root node, and have sub-
branches that can also contain
sub-branches. The actual data
values are usually stored at the
leaf levels of a tree.
Branch
Branch
Value
Value
Branch
Branch
Value
Value
 
Search WWH ::




Custom Search