{"id":1104,"date":"2016-06-24T03:48:36","date_gmt":"2016-06-24T10:48:36","guid":{"rendered":"https:\/\/database.guide\/?p=1104"},"modified":"2016-06-24T03:50:20","modified_gmt":"2016-06-24T10:50:20","slug":"nosql-database-types","status":"publish","type":"post","link":"https:\/\/database.guide\/nosql-database-types\/","title":{"rendered":"NoSQL Database Types"},"content":{"rendered":"<p><a href=\"https:\/\/database.guide\/what-is-nosql\/\">NoSQL<\/a> databases are often categorised under four main types. Some databases are a mix between different types, but in general, they fit under\u00a0the following\u00a0main categories.<\/p>\n<p><!--more--><\/p>\n<h2>Key-Value<\/h2>\n<p>A <a href=\"https:\/\/database.guide\/what-is-a-key-value-database\/\">key-value database<\/a>, is a database that uses a simple key\/value method to store data.<\/p>\n<p>The key-value part refers to the fact that the database stores\u00a0data as a collection of key\/value pairs. This is a simple method of storing data, and it is known to\u00a0scale well.<\/p>\n<p>Here&#8217;s an example of a key-value store:<\/p>\n<table>\n<tbody>\n<tr>\n<th>Key<\/th>\n<th>Value<\/th>\n<\/tr>\n<tr>\n<td>Bob<\/td>\n<td>(123)\u00a0456-7890<\/td>\n<\/tr>\n<tr>\n<td>Jane<\/td>\n<td>(234) 567-8901<\/td>\n<\/tr>\n<tr>\n<td>Tara<\/td>\n<td>(345) 678-9012<\/td>\n<\/tr>\n<tr>\n<td>Tiara<\/td>\n<td>(456) 789-0123<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This is a simple phone directory. The person&#8217;s name is the key, and the phone number is the value.<\/p>\n<p>This type of database is very quick to query, due to its simplicity.<\/p>\n<p>The key-value model is well suited to storing things like user profiles and session info on a website, blog comments, telecom directories, IP forwarding tables, shopping cart contents on e-commerce sites, and more.<\/p>\n<p>Examples of key-store\u00a0database management systems\u00a0include:<\/p>\n<ul>\n<li><a href=\"http:\/\/redis.io\/\">Redis<\/a><\/li>\n<li><a href=\"https:\/\/www.oracle.com\/database\/nosql\/index.html\">Oracle NoSQL Database<\/a><\/li>\n<li><a href=\"http:\/\/www.project-voldemort.com\/voldemort\/\">Voldemorte<\/a><\/li>\n<li><a href=\"http:\/\/www.aerospike.com\/\">Aerospike<\/a><\/li>\n<li><a href=\"https:\/\/www.oracle.com\/database\/berkeley-db\/index.html\">Oracle Berkeley DB<\/a><\/li>\n<\/ul>\n<h2>Document Store<\/h2>\n<p>A\u00a0<a href=\"https:\/\/database.guide\/what-is-a-document-store-database\/\">document store database<\/a>\u00a0uses a document-oriented model to store data. It is similar to a\u00a0key-value database in that it uses a key-value approach. The difference is that, the value in a\u00a0document store database consists of semi-structured data.<\/p>\n<p>Also known as a document oriented or aggregate database, a document store database stores each record and its associated data within a single <i>document<\/i>. Each document contains semi-structured data that can be queried against using various\u00a0query and analytics\u00a0tools of the <a href=\"https:\/\/database.guide\/what-is-a-dbms\/\">DBMS<\/a>.<\/p>\n<p>The documents in document stores are usually\u00a0XML or JSON, but some DBMSs use other languages, such as BSON, YAML, etc.<\/p>\n<p>Here&#8217;s an\u00a0example of a document written in\u00a0JSON:<\/p>\n<pre>{\r\n    '_id' : 1,\r\n    'artistName' : { 'Iron Maiden' },\r\n    'albums' : [\r\n        {\r\n            'albumname' : 'The Book of Souls',\r\n            'datereleased' : 2015,\r\n            'genre' : 'Hard Rock'\r\n        }, {\r\n            'albumname' : 'Killers',\r\n            'datereleased' : 1981,\r\n            'genre' : 'Hard Rock'\r\n        }, {\r\n            'albumname' : 'Powerslave',\r\n            'datereleased' : 1984,\r\n            'genre' : 'Hard Rock'\r\n        }, {\r\n            'albumname' : 'Somewhere in Time',\r\n            'datereleased' : 1986,\r\n            'genre' : 'Hard Rock'\r\n        }\r\n    ]\r\n}<\/pre>\n<p>In a document store, this\u00a0document can\u00a0be retrieved by referring to the <code>_id<\/code>.<\/p>\n<p>Document store databases can be used for a wide variety of use cases. They\u00a0are ideal for content management systems, blogging platforms, and other web applications.<\/p>\n<p>They are also well suited for user generated content such as blog comments, chat sessions, tweets, ratings, etc.<\/p>\n<p>Document stores are also great\u00a0for providing\u00a0real time\u00a0analytics and other reporting features.<\/p>\n<p>Here are examples of document store\u00a0DBMSs.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.mongodb.com\/\">MongoDB<\/a><\/li>\n<li><a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/documentdb\/\">DocumentDB<\/a><\/li>\n<li><a href=\"http:\/\/couchdb.apache.org\/\">CouchDB<\/a><\/li>\n<li><a href=\"http:\/\/www.marklogic.com\/\">MarkLogic<\/a><\/li>\n<li><a href=\"http:\/\/orientdb.com\/\">OrientDB<\/a><\/li>\n<\/ul>\n<h2>Column Store<\/h2>\n<p>A <a href=\"https:\/\/database.guide\/what-is-a-column-store-database\/\">column store database<\/a> is a type of database that stores\u00a0data using a column oriented model.<\/p>\n<p>Column stores work in a similar fashion to <a href=\"https:\/\/database.guide\/what-is-an-rdbms\/\">relational databases<\/a> in that they have rows, columns, and tables (also known as <i>column families<\/i>). However, these work differently in column store databases.<\/p>\n<p>In a column store database,\u00a0the columns in\u00a0each row are contained within that row. Each row can have\u00a0different columns to the other rows. They can be in a different order, then can even have different data types, etc.<\/p>\n<p>Here&#8217;s a diagram to demonstrate\u00a0this:<\/p>\n<figure id=\"attachment_1090\" aria-describedby=\"caption-attachment-1090\" style=\"width: 692px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/wide_column_store_database_example_column_family-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1090\" src=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/wide_column_store_database_example_column_family-1.png\" alt=\"Diagram of a column family in a wide column store database.\" width=\"702\" height=\"612\" srcset=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/wide_column_store_database_example_column_family-1.png 702w, https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/wide_column_store_database_example_column_family-1-300x262.png 300w, https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/wide_column_store_database_example_column_family-1-676x589.png 676w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/a><figcaption id=\"caption-attachment-1090\" class=\"wp-caption-text\">A column family containing 3 rows. Each row contains its own set of columns.<\/figcaption><\/figure>\n<p>This method of storing data can be extremely quick to load and query.<\/p>\n<p>Columnar databases can also store\u00a0massive amounts of data, and they\u00a0can be scaled easily using massively parallel processing (<a href=\"https:\/\/database.guide\/what-is-an-mpp-database\/\">MPP<\/a>),\u00a0which involves having data spread across a large cluster of machines.<\/p>\n<p>Examples of column store databases include:<\/p>\n<ul>\n<li><a href=\"https:\/\/cloud.google.com\/bigtable\/\">Bigtable<\/a><\/li>\n<li><a href=\"http:\/\/cassandra.apache.org\/\">Cassandra<\/a><\/li>\n<li><a href=\"https:\/\/hbase.apache.org\/\">HBase<\/a><\/li>\n<li><a href=\"http:\/\/www8.hp.com\/us\/en\/software-solutions\/advanced-sql-big-data-analytics\/\">Vertica<\/a><\/li>\n<li><a href=\"http:\/\/druid.io\/\">Druid<\/a><\/li>\n<li><a href=\"https:\/\/accumulo.apache.org\/\">Accumulo<\/a><\/li>\n<li><a href=\"http:\/\/www.hypertable.com\/\">Hypertable<\/a><\/li>\n<\/ul>\n<h2>Graph<\/h2>\n<p><a href=\"https:\/\/database.guide\/what-is-a-graph-database\/\">Graph databases<\/a> use\u00a0a graphical\u00a0model to\u00a0represent and store the data.<\/p>\n<p>Here&#8217;s a\u00a0basic\u00a0example of how graph databases store and present data:<\/p>\n<figure id=\"attachment_903\" aria-describedby=\"caption-attachment-903\" style=\"width: 440px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/graph_database_relationship_example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-903\" src=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/graph_database_relationship_example.png\" alt=\"Screenshot of a simple graph database.\" width=\"450\" height=\"432\" srcset=\"https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/graph_database_relationship_example.png 450w, https:\/\/database.guide\/wp-content\/uploads\/2016\/06\/graph_database_relationship_example-300x288.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><figcaption id=\"caption-attachment-903\" class=\"wp-caption-text\">Example of a simple graph database.<\/figcaption><\/figure>\n<p>The circles are <dfn>nodes<\/dfn> &#8211; they contain the data. The arrows represent the relationships that each node has with other\u00a0nodes.<\/p>\n<p>Graph databases are an excellent choice for working with connected data &#8211; data that contains\u00a0lots of interconnected relationships. In fact, graph databases are much more suited to displaying relational data than relational databases.<\/p>\n<p>Graph databases are very well suited to applications like social networks, realtime product recommendations, network diagrams, fraud detection, access management, and more.<\/p>\n<p>As with most NoSQL databases, there&#8217;s no fixed <a href=\"https:\/\/database.guide\/what-is-a-database-schema\/\">schema<\/a> as such. \u00a0Any &#8220;schema&#8221; is simply a reflection of the data that has been entered. As more varied data is entered, the schema grows accordingly.<\/p>\n<p>Examples of graph databases include\u00a0<a href=\"http:\/\/neo4j.com\/\">Neo4j<\/a>,\u00a0<a href=\"https:\/\/www.blazegraph.com\/\">Blazegraph<\/a>, and\u00a0<a href=\"http:\/\/orientdb.com\/\">OrientDB<\/a>.<\/p>\n<p>Also check out this list of <a href=\"https:\/\/database.guide\/list-of-graph-database-management-systems\/\">over 40 graph database management systems<\/a>.<\/p>\n<h2>Multi\u00a0Model<\/h2>\n<p>Some databases include features\/characteristics of more than one data model. These databases are usually categorised under one\u00a0or both of the models they use. They can also be referred to\u00a0as multi\u00a0model databases.<\/p>\n<p>Some examples of multi\u00a0model databases include:<\/p>\n<ul>\n<li><a href=\"http:\/\/orientdb.com\/\">OrientDB<\/a>. OrientDB combines\u00a0a graph model with\u00a0a document model.<\/li>\n<li><a href=\"https:\/\/www.arangodb.com\/\">ArangoDB<\/a>. Uses key\/value, document, and graph models.<\/li>\n<li><a href=\"http:\/\/virtuoso.openlinksw.com\/\">Virtuoso<\/a>. Combines relational, graph, and document models.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>NoSQL databases are often categorised under four main types. Some databases are a mix between different types, but in general, they fit under\u00a0the following\u00a0main categories.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,43],"tags":[42],"class_list":["post-1104","post","type-post","status-publish","format-standard","hentry","category-database-concepts","category-nosql","tag-nosql"],"_links":{"self":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/comments?post=1104"}],"version-history":[{"count":5,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/1104\/revisions"}],"predecessor-version":[{"id":1111,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/1104\/revisions\/1111"}],"wp:attachment":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/media?parent=1104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/categories?post=1104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/tags?post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}