As a hobby project I am developing a system which stores data from different kind of sensors around the house. Currently it is implemented using ASP.Net MVC 6 and MongoDB for the database. (I choose MongoDB because I was curious about how it works) Every sensor peroidically posts data to the server on it's own.
For the sake of not having to store the same information possibly hundreds of times I am using references for redundant data. This data includes the type of a sensor, the data fields used by the sensor(and information about fields like it's name, etc).
Here is an example in JSON format:
// Sensors collection
{
_id : 1,
TypeId : 1
}
// SensorTypes
{
_id : 1,
GenericName : "Test sensor",
FieldIds : [1, 2]
}
// Fields
[{
_id : 1,
Name : "field1",
DecimalPlaces : 2
},
{
_id : 2,
Name : "field2",
DecimalPlaces : 3
}]
Questions:
- Is this good practice? Am I using correct and preferred way to avoid redundancy in my database?
- "Schema" of my documents can be displayed like a graph. Does a graph database like Neo4j would be more suitable for my problem?
Thank you for your help!