4 Architecting IoT Cloud
199
{
Person: {
first_name: “Farshad”,
last_name: “Firouzi”,
address: [
{ “type”: “home”, “city”: “Dusseldorf”, “country”: “Germany”},
{“type”: “home”, “city”: “Austin”, “country”: “USA”}
],
}
}
Fig. 4.15 A sample MongoDB document
• Index: Indexes are used to execute queries efficiently. Without them, MongoDB
has to scan every document in the collection to select documents matching the
query. However, if an index exists for the stated query, MongoDB can then reduce
the number of scanned documents.
Both RDBMS and MongoDB databases have their own uses. In this section we
highlight the main advantages of MongoDB. However, based on their requirements
of the target IoT application, any of them can be used.
• The main advantage of MongoDB is that it is schemaless. This means that
documents are flexible and you do not need to enforce any schema/structure on
them.
• MongoDB includes a built-in aggregation framework capable of performing
ETL (extract, transform, and load) jobs. It also has a deep query ability with
a document-based language almost as powerful as SQL.
• It is very straightforward to scale (scale-out) MongoDB horizontally.
• MongoDB is “object-oriented” and can easily represent any object structure in
your domain.
• MongoDB enables organizations of all sizes to build data-driven applications
faster. The reason is that MongoDB does not require complex object-relational
mapping (ORM) layer to map objects in code to relational tables. Therefore, it
is much simpler for developers to understand and map the data stored in the
database to data in the application. Moreover, there is no need to spread the data
across different relational tables and all the data can be found only in one single
place.
4.6.1.2 Cassandra
Cassandra is a popular, open-source, wide-column, decentralized/distributed
database used for storing high volumes of (semi)-structured data with high
availability and no single point of failure. The Cassandra is a database-oriented by
column. Rows contain what is often thought of as vertical data that would usually
Précédent

- 206/647

Suivant