NoSQL Databases

by K. Yue

1. Introduction

2. Advantages and Disadvantages

3. ACID versus BASE Transaction Models

3.1 ACID

3.2 BASE

3.3 CAP Theorem

4. Major NoSQL data models

4.1 Key-value model

  1. Data is stored as key-value pairs.
  2. Values can possibly be JavaScript Object Notation (JSON) strings, which store serialized objects.
  3. Some key-value databases support rich JSON queries.

4.2 Document Model

Example: In CouchDB, a key-value pair may be:

Key: "MBSEBaseModel~939c7672-5d2d-11ec-bf63-0242ac130002"

Value to be stored:

{
   "BCAssetId": "939c7672-5d2d-11ec-bf63-0242ac130002",
   "BCAssetType": "MBSEBaseModel",
   "BCAssetName": "Gateway-PPE-Base-Model",
   "BaseModelDesc": "PPE project's model.",
   "version": {
      "version": "2.1",
      "subversion": "4.6",
      "startTime": "2021-12-08T17:25:23+06:00"
   },
   "storage": {
      "isEncrypted": true,
      "EncrypMethod": "AES256",
      "EncrypKey": "q4t7w!z%C*F-JaNdRgUkXp2r5u8x/A?D",
      "useIPFS": true,
      "IPFSCid": "QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX",
      "IPFS_HashHead": "A0Xa",
      "payloadRaw": "raw PPE MBSE Base model description. V2.1.4.6.",
   }
}

Note:

To query CouchDB, one may use many methods. Examples:

  1. CouchDB RESTful API: https://docs.couchdb.org/en/latest/api/index.html
  2. MapReduce-based views: https://docs.couchdb.org/en/latest/ddocs/views/index.html
  3. Mango query:

An example Mango query that returns all CouchDB key-value pairs for MBSEBaseModel.

{
    "selector": {
        "BCAssetType": { "$eq": "MBSEBaseModel" }
    }
}

See https://docs.couchdb.org/en/latest/api/database/find.html for more information about selector syntax.

4.3 Wide-Column Model

4.4 Graphical Model