Details
- 
        Type:
Monitor
 - 
        Status: Closed
 - 
            Priority:
 Major
                
             - 
            Resolution: Done
 - 
            Affects Version/s: None
 - 
            Fix Version/s: 2021
 - 
            Component/s: FIWARE-TECH-HELP
 - 
            Labels:
 
- 
                        HD-Enabler:Quantum-Leap
 
Description
Created question in FIWARE Q/A platform on 18-09-2019 at 10:09
Please, ANSWER this question AT https://stackoverflow.com/questions/57987944/how-to-add-timeinstant-creationdate-and-modifieddate-into-cratedb-with-orion-co
Question:
How to add TimeInstant, CreationDate and ModifiedDate into CrateDB with Orion Context Broker?
Description:
I'm setting up a Firmware-Framework, where I unforutunately have to add historically Sensor Values. But I also need the creationDate and the modificationDate for other usecases.  
Therefore I add the Attribute "Metadata" with the variable "TimeInstant". Then I create an Entity, create an Orion-Subscription for that Entity and update the Entity with my old Sensor-Valses.
The Json-File I send to the Orion-Context Broker to update the Attribute looks like this:
{
"metadata": {
    "TimeInstant": 
},
"type": "Number",
"value": 0.0132361 }
The Output in my Mongo-DB like this:
"_id":
{ "id": "urn:ngsi-ld:SensorB-K1200____", "type": "Sensor", "servicePath": "/test/servicepath" },
"attrNames": [
    "Sensor_value"
],
"attrs": {
    "Sensor_value": {
        "value": 0.01632361,
        "type": "Number",
        "md": {
            "TimeInstant": 
        },
        "mdNames": [
            "TimeInstant"
        ],
        "creDate": 1568712813,
        "modDate": 1568735930
    }
},
"creDate": 1568712813,
"modDate": 1568735930,
"lastCorrelator": "0a129232-d964-11e9-8e5a-0242ac130009" }
But my Crate-DB only has the columns:
entity_id   entity_type fiware_servicepath  sensor_value    time_index 
My Subscription File looks like this:
{
"expires": "2019-12-24T18:00:00",
"notification": {
    "http": 
,
    "metadata": [
        "dateCreated",
        "dateModified",
        "TimeInstant"
    ]
},
"subject": {
    "entities": [
    ]
},
"throttling": 0 }
I've tried changing the "Metadata" Attributes in the Subscription-File, also tried restartig Crate-DB, ContextBroker e.g..
I excpect the CrateDb to show all three values: "dateCreated", "dateModified" and "TimeInstant".
2019-09-18 12:06|CREATED monitor | # answers= 0, accepted answer= False