The Library database
In Chapter 5, Relational Databases, we created a Library
database as an Rdb, using NetBeans Java DB relational database system. The design for that database is shown in Figure 5-2. (The same database could have been built using MySQL or any other Rdb.) Here, we will build a MongoDB database for the same data.
As mentioned previously, the only preliminary design decisions that we have to make are the names of the database itself and its collections. We'll name the database library
, and its three collections authors
, publishers
, and books
. These are created in Figure 10-11:
Then, we can insert some date, as shown in Figure 10-12:
Here, we have inserted six documents in the authors
collection, representing six authors.
Notice that we have given each document four fields: _id
, lname
, fname
, and yob
. The first three are strings and the last is an integer. The _id
field values...