Abstract Hybrid DB

Relational NoSQL database

This something that I tried to work on. It is a SQL and NoSQL hybrid database where data is stored un-structured but has relationships in them.

Features also include a socket between database and the front end where data can be directly pushed to the front end without a application in the middle to handle it.

Table1

{  _id:1  , data:{  type: 100   }  }
{  _id:2  , data:{  type: 100   }  }
{  _id:3  , data:{  type: 200   }  }

Table2

{  _id:1   , type: 100 , check: 1 }
{  _id:2   , type: 200 , check: 0 }
{  _id:3   , type: 300 , check: 1 }

SQL

Select Table1.*  , Table2.* From Table1 Inner Join Table2 
On Table1.data.type = Table2.type Where Table.check=1

Result

[ 
	{  

           "Table1":   {  "_id":1 ,"type":100 , "data":{  "type": 100 }}, 

           "Table2" :  {  "_id":1, "type": 100 , "check": 1 } 

        } ,{  
            "Table1":   {  "_id":2 ,"type":100 , "data":{  "type": 100 }}, 

            "Table2" :  {  "_id":1, "type": 100 , "check": 1 } 

        }
]

Database and Front End Socket

This can be used in SPA applications to have a real time experience.

  1. HTTP request
  2. Database query from the database and a token
  3. Data base results
  4. HTTP response
  5. Real time socket - it can communicate with the database directly without having to go through the backend using a token.

Database storage in MySQL as key values

Storage of the following

{
	“id”:1,
	“name”:”Pasindu De Silva”,
	“favnum”:7,
	“favfood”:[ “rice” , “doughnuts” ],
	“address”:{
		“first_line”:”First lane”,
		“province”:”western”,
		“country”:”Sri Lanka”
    }
}

Table Name - User_Name

1 | Pasindu De Silva
2 |

Table Name - User_Favnum

1 | 7
2 |

Table Name - User_Favfood

1 | Array

Table Name - User_Favfood_1 - (1 stands for the )

1 | Rice
2 | Doughnuts 

Table Name - User_address

1 | Object

Table Name - User_address_1 - (1 stands for the )

1 | first_line
2 | province
3 | country

Table Name - User_address_1.first_line - (1 stands for the )

1 | First Lane
2 | 

Table Name - User_address_1.province - (1 stands for the { id } , { “.province” } - shows a field)

1 | Western
2 |

Table Name - User_address_1.country - (1 stands for the { id } , { “.country” } - shows a field)

1 | Sri Lanka
2 |

Optimization

TODO

TBC