Hi, it’s my first topic so please let me know if I’m missing something or if there’s a lack of info or code. Thanks in advance.
I have two collections Stations and Relays inside the same DB. I’m working with MongoDB C#/.NET Driver.
What I’m trying to do is use Relays collection as a collection of template documents. This means that any document of Relays should be a placeholder of data. Then I would like to make a reference to those documents (just to the structure) from sub-documents inside Stations collection and fill these documents with data.
Stations documents have the following structure:
[{ "BasicInfo": {
"Name": "STATION DEMO"
},
"Cells": [
{ "BasicInfo": {
"Name": "Cell01"
},
"Relays": [
{ "BasicInfo": {
"Name": "Relay1"
},
"Functions": [
{ "BasicInfo": {
"Name": "Function1"
},
"Settings": [
{ "BasicInfo": {
"Name": "Setting1"
},
"SettingValue": "1" //Relay document with filled data
},
{ "BasicInfo": {
"Name": "Setting2"
},
"SettingValue": "2" //Relay document with filled data
}
]
}
]
}
]
}
]
}]
Relays documents have the following structure:
[{ "BasicInfo": {
"Name": "RelayName"
},
"Functions": [
{ "BasicInfo": {
"Name": "FunctionName"
},
"Settings": [
{ "BasicInfo": {
"Name": "SettingName1"
},
"SettingValue": null //Property to fill with data in Stations collection
},
{ "BasicInfo": {
"Name": "SettingName2"
},
"SettingValue": null //Property to fill with data in Stations collection
}
]
}
],
"IsMultiFunction": false
}]
How can achieve this?