Details
-
Type:
Monitor
-
Status: Closed
-
Priority:
Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
HD-Enabler:STH-Comet
Description
Created question in FIWARE Q/A platform on 02-11-2018 at 19:11
Please, ANSWER this question AT https://stackoverflow.com/questions/53124128/how-can-you-store-structured-context-values-for-attributes-in-fiware-sth-data-st
Question:
How can you store structured context values for attributes in Fiware STH data store?
Description:
Background
I'm using the following Generic Enablers in a specific application that I am building over FIWARE:
Orion Context Broker
CYGNUS NGSI
STH-Comet
Also, I'm using MongoDB database, in order to persist all raw historical data received by Cygnus. To do so, I've configured a MongoDB Sink in CYGNUS, as indicated here.
Then I have a context entity, for which some attributes has structured values, instead of simple types like string. For example: a collection or a dictionary.
Fortunately this is possible!! Check the Orion's official documentation for details.
Apart from simple values such as 22.5 or "yellow", you can use complex structures as attribute values. In particular, an attribute can be set to a vector or to a key-value map (usually referred to as an "object") at creation/update time. These values are retrieved at query and notification time
The Problem
I was able to correctly define the value of these attributes through creation/update operations in Orion Context Broker but when these values are stored in my STH-Comet database they are stored as an "escaped" string (see the detailed example below).
{
"_id" : ObjectId("5bdb611d9aa6ab00017e8c82"),
"recvTime" : ISODate("2018-11-01T20:25:01.640Z"),
"entityId" : "foo",
"entityType" : "foo",
"attrName" : "bar",
"attrType" : "T",
"attrValue" : "[
,
{\"nested_attr2\":\"v2\"}]"
}
Question
So my question is, what did I do wrong? Maybe I missed some detail within my configuration?
Thank you in advance
Activity
Field | Original Value | New Value |
---|---|---|
Component/s | FIWARE-TECH-HELP [ 10278 ] |
Assignee | Joaquín Salvachúa [ joaquin.salvachua ] |
Assignee | Joaquín Salvachúa [ joaquin.salvachua ] | Andres Muñoz [ andres.munoza ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Answered [ 10104 ] |
Resolution | Done [ 10000 ] | |
Status | Answered [ 10104 ] | Closed [ 6 ] |
Summary | [fiware-stackoverflow] How can you store structured context values for attributes in Fiware STH data store? | FIWARE.Question.Tech.How can you store structured context values for attributes in Fiware STH data store?. |
HD-Enabler | STH-Comet [ 11303 ] | |
Description |
Created question in FIWARE Q/A platform on 02-11-2018 at 19:11 {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/53124128/how-can-you-store-structured-context-values-for-attributes-in-fiware-sth-data-st +Question:+ How can you store structured context values for attributes in Fiware STH data store? +Description:+ Background I'm using the following Generic Enablers in a specific application that I am building over FIWARE: Orion Context Broker CYGNUS NGSI STH-Comet Also, I'm using MongoDB database, in order to persist all raw historical data received by Cygnus. To do so, I've configured a MongoDB Sink in CYGNUS, as indicated here. Then I have a context entity, for which some attributes has structured values, instead of simple types like string. For example: a collection or a dictionary. Fortunately this is possible!! Check the Orion's official documentation for details. Apart from simple values such as 22.5 or "yellow", you can use complex structures as attribute values. In particular, an attribute can be set to a vector or to a key-value map (usually referred to as an "object") at creation/update time. These values are retrieved at query and notification time The Problem I was able to correctly define the value of these attributes through creation/update operations in Orion Context Broker but when these values are stored in my STH-Comet database they are stored as an "escaped" string (see the detailed example below). { "_id" : ObjectId("5bdb611d9aa6ab00017e8c82"), "recvTime" : ISODate("2018-11-01T20:25:01.640Z"), "entityId" : "foo", "entityType" : "foo", "attrName" : "bar", "attrType" : "T", "attrValue" : "[{\"nested_attr1\":\"v1\"},{\"nested_attr2\":\"v2\"}]" } Question So my question is, what did I do wrong? Maybe I missed some detail within my configuration? Thank you in advance |
Created question in FIWARE Q/A platform on 02-11-2018 at 19:11
{color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/53124128/how-can-you-store-structured-context-values-for-attributes-in-fiware-sth-data-st +Question:+ How can you store structured context values for attributes in Fiware STH data store? +Description:+ Background I'm using the following Generic Enablers in a specific application that I am building over FIWARE: Orion Context Broker CYGNUS NGSI STH-Comet Also, I'm using MongoDB database, in order to persist all raw historical data received by Cygnus. To do so, I've configured a MongoDB Sink in CYGNUS, as indicated here. Then I have a context entity, for which some attributes has structured values, instead of simple types like string. For example: a collection or a dictionary. Fortunately this is possible!! Check the Orion's official documentation for details. Apart from simple values such as 22.5 or "yellow", you can use complex structures as attribute values. In particular, an attribute can be set to a vector or to a key-value map (usually referred to as an "object") at creation/update time. These values are retrieved at query and notification time The Problem I was able to correctly define the value of these attributes through creation/update operations in Orion Context Broker but when these values are stored in my STH-Comet database they are stored as an "escaped" string (see the detailed example below). { "_id" : ObjectId("5bdb611d9aa6ab00017e8c82"), "recvTime" : ISODate("2018-11-01T20:25:01.640Z"), "entityId" : "foo", "entityType" : "foo", "attrName" : "bar", "attrType" : "T", "attrValue" : "[{\"nested_attr1\":\"v1\"},{\"nested_attr2\":\"v2\"}]" } Question So my question is, what did I do wrong? Maybe I missed some detail within my configuration? Thank you in advance |
Fix Version/s | 2021 [ 12600 ] |
Transition | Time In Source Status | Execution Times | Last Executer | Last Execution Date | |||||
---|---|---|---|---|---|---|---|---|---|
|
11d 18h 5m | 1 | Andres Muñoz | 14/Nov/18 3:11 PM | |||||
|
6d 20h 15m | 1 | Andres Muñoz | 21/Nov/18 11:27 AM | |||||
|
1s | 1 | Andres Muñoz | 21/Nov/18 11:27 AM |
2018-11-02 21:06|CREATED monitor | # answers= 0, accepted answer= False