fiwarefiware-cygnus

cygnus mongo sink and meta data storing


I tried to stored this meta data entity but seems like cygnus is only storing entity data no meta data was stored in the data base.

Here is how I update my entity using NGSI v1 updateContext

{
    "contextElements": [
        {
            "type": "dummyMeta",
            "isPattern": "false",
            "id": "dummyMeta",
            "attributes": [
                {
                    "name": "dummy",
                    "type": "float",
                    "value": "26.5",
                    "metadatas": [
                        {
                            "name": "accuracy",
                            "type": "float",
                            "value": "1"
                        }
                    ]
                }
            ]
        }
    ],
    "updateAction": "APPEND"
}

Here is the payload subscription:

{

    "entities": [
      {
        "id": "dummyMeta",
        "type": "dummyMeta",
        "isPattern": "false"
      }
    ],

      "attributes": [
        "dummy"
      ]

  ,
  "reference": "http://cygnusserver.ddns.net:5050/notify",
  "duration":"P1M",
   "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "dummy"
            ]
        }
    ],
    "throttling": "PT5S"
}

here is how it is stored in the data base

> db['kura_/egmmqtt_dummyMeta_dummyMeta'].find().sort({$natural:-1})
{ "_id" : ObjectId("57c929d8902531258a3c6ed0"), "recvTime" : ISODate("2016-09-02T07:27:18.331Z"), "attrName" : "dummy", "attrType" : "float", "attrValue" : "26.5" }
{ "_id" : ObjectId("57c92990902531258a3c6ecc"), "recvTime" : ISODate("2016-09-02T07:26:04.148Z"), "attrName" : "dummy", "attrType" : "float", "attrValue" : "26.5" }

What am I missing to be able to store the whole information (data and metadata) about the attribute? Thanks in advance for your help!


Solution

  • MongoDB sink does not save the metadata by design. It is a requirement by our internal products currently using Cygnus.

    Being said that, I think it should not be very difficult to modify the code by your side in order to save the metadata.

    Alternatively, I can create an issue about optionally save metadata when configured through a configuration parameter. Nevertheless, I cannot commit with an implementation date.