Skip to content

Database structures

Alpha59 edited this page Apr 14, 2015 · 2 revisions

Database structures

Mongo

Mongo is a document database that utilizes collections of documents.

Assets.*

	{ 
		_id: ObjectId("507f1f77bcf86cd799439011"),
		// This is the area that developers are able to 
		// upsert via the **Asset Management API**, they are not given upsert access 
		// to the lux_info
		,lux_info:{
				// Information being stored by other APIs
		}
	}	

System.User

	{ 
		_id: ObjectId("507f1f77bcf86cd799439011"),
		values:{ // set by **User Management API**
					email:
					name:
					phone_num:
					ect.
		},
		profile_access_level: // set by **User Management API**
		permissions:{
				,assets:{
					0: [] // creator
					1: [] // owner
					2: [] // editor
					3: [] // viewer
					4: [] // denied
				},
				social_network:{
					chat:
					inbox:
					join:
					// other things that can be restricted
				}
		},
		suspension_status:{
					user_level:{
							bool:
							reason:
							time:
							last_suspension:{
								time:
								reason:
							}
					},
					system_level:{
							bool:
							reason:
							time:
							last_suspension:{
								time:
								reason:
							}
					},
		},
		loc:{
				type: "Point"
				, coordinates: [ 40, 5 ] 
		},
		lux_info{
			// stuff like the user's access_token
		}
	}

Stats.Scoreboard

	{
		"_id" : ObjectId("54eb780f883e4ae10378ec6b"),
		"user_id" : ObjectId("54ae0b30e43ca55e86db0eb3"),
		"levels1" : [ ],
		"levels2" : [
			{
				checkpoint_id: ObjectId("54ae0b30e43ca55e86db0eb3"),
				metric1:
				metric2:
				metric3:
			}
		],
		items: [ ], 
		info:{
			// key->values 
		}
		"time_created" : "2015-02-23T18:57:18.975Z",
		"last_time_modified" : "2015-02-23T18:57:18.975Z"
	}

RTU.Pub

	{
		// This portion is a direct copy of the document in the Asset's database
		//
		//
		"publication_info" : {
			"sender" : ObjectId("54ae0b30e43ca55e86db0eb3"),
			"timestamp" : "0.97971300 1422309133",
			"priority" : NumberLong(0),
			"checked_by" : {
				"python" : false,
				"node" : false
			}
		}
	}

RTU.Sub

	{
		"_id" : ObjectId("54b6bc6f98cac76ee552f548"),
		subscription:{
			collection:
			,"query" : {
				// A Query that can be used by the Asset's Database
			},
		}
		"subscribers" : [
			{
				"id" : ObjectId("54b3f81898cac76ee552e27f")
				// meta data
			}
		],
		// more meta data
		"timestamp" : "0.47691600 1421261964"
	}

RTU.Sockets

	{
		"_id" : ObjectId("54b6bc6f98cac76ee552f548"),
		subscriber:{
			"id" : ObjectId("54b3f81898cac76ee552e27f")
			// meta data
		}
		sockets:{
			websocket:{}
			udp_socket:{}
			ect:{}
		}
	}

Sessions.php

	{
		"_id" : ObjectId("54b6bc6f98cac76ee552f548"),
		// This portion of the document is dedicated to session info
		// and can be accessed via a key->value pair system
		lux_info:{
			user_id:ObjectId("54b6bc6f98cac76ee552f548"), // this is optional for restoring session in the future
			,expiration:
			,session_id:
			,cookie_id:
			// other meta data
		}
	}

Files.*

	{ 
		_id: ObjectId("507f1f77bcf86cd799439011"),
		url: // url to access the document on S3
		access_rights:
		owner:
		uploader:
		time_uploaded:
		file_info:{
			type:
			size:
			name:
			ect.
		}
		lux_info:{
			// whatever meta data you want, just don't return it to the client
		}
	}

System.Groups

	{ 
		_id: ObjectId("507f1f77bcf86cd799439011"),
		values:{ // set by **User Management API**
					email:
					name:
					phone_num:
					ect.
		},
		profile_access_level: // set by **User Management API**
		permissions:{
				,assets:{
					owner: []
					creator:[]
					editor:[]
					viewer:[]
					denied:[]
				}
				social_network:{
					chat:
					inbox:
					join:
					// other things that can be restricted
				}
		},
		suspension_status:{
					user_level:{
							bool:
							reason:
							time:
							last_suspension:{
								time:
								reason:
							}
					},
					system_level:{
							bool:
							reason:
							time:
							last_suspension:{
								time:
								reason:
							}
					},
		},
		{ 
			loc:{
					type: "Point"
					, coordinates: [ 40, 5 ] 
			}
		}
	}

System.Templates

	{
		"_id" : ObjectId("54b6bc6f98cac76ee552f548"),
		page_name:
		section_name:
		section_body:
		lux_info:{
			rendering_settings:{
				engine:
				parameters:
			}
			// whatever meta data you want, just don't return it to the client
		}
	}

System.CMS

	{
		"_id" : ObjectId("54b6bc6f98cac76ee552f548"),
		page_name:
		section_name:
		section_handler:
		section_short:
		... // steal these areas from wordpress
		section_full:
		lux_info:{
			// whatever meta data you want, just don't return it to the client
		}
		timestamp:
	}

System.Settings

System.API

	{ 
		_id: ObjectId("507f1f77bcf86cd799439011"),
			service:
			base_url:
			in_OAuth_url:{
				key:value
				access_token:ajdsnsadsa
				client_id:adasfdskjab
				// other key:value pairs for 
			},
			in_Server_url:{
				key:value
				access_token:ajdsnsadsa
				client_id:adasfdskjab
				// other key:value pairs for 
			}
			
	}

Transactions

neo4j

Neo4j is a powerful graph database that uses JSON documents on both of the nodes and edges

Users

	("31232132132131232312", // neo4j id
		{
			values:{
						about:
						age_range:
						birthday:
						emails:[]
						ect.
			}
			,lux_info:{
				// whatever metadata you want. Just don't return this to the client
			}
		}
	)

Groups

	("31232132132131232312", // neo4j id
		{
			values:{
			}
			,lux_info:{
				// whatever metadata you want. Just don't return this to the client
			}
		}
	)

Clone this wiki locally