I need to create a Mongoose model for the below nested JSON array. The issue I am facing is TLSM01 is a dynamic Key and I am unable to specify it in the model. If I mention entities alone and pass the all the json objects as string it is storing as [object] and not data.
"entities": [
{
"TLSM01": [
{
"01": {
"Name": "Light",
"Properties": [
{
"state": [
{
"type": "boolean",
"propertyMode": "actuator"
}
],
"brightness": [
{
"type": "integer",
"propertyMode": "actuator"
}
]
}
]
}
}
]
}
Mongoose Model:
var thingsSchema = ({
"uuid": String,
"things": String,
"manufacturerName": String,
"manufacturerId": String,
"osName": String,
"hardwareVersion": String,
"firmwareVersion": String,
"entity": [{String}]
})
via Karthikeyan Prakash
No comments:
Post a Comment