Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-8188

[fiware-stackoverflow] Fiware - Orion Context Broker subscription V1, "conditions was supposed to be an array"

    Details

      Description

      Created question in FIWARE Q/A platform on 27-01-2017 at 15:01
      Please, ANSWER this question AT http://stackoverflow.com/questions/41895831/fiware-orion-context-broker-subscription-v1-conditions-was-supposed-to-be-an

      Question:
      Fiware - Orion Context Broker subscription V1, "conditions was supposed to be an array"

      Description:
      When trying to use STH to be able to store and retrieve data sent to OCB, I have a problem making the subscription.

      My problem is that the subscription creation goes well.
      When I create the subscription as following:

      POST /v1/contextSubscriptions HTTP/1.1
      Host: <cb_host>:1026
      Content-Type: application/json
      Fiware-Service: myService
      Fiware-ServicePath: /myServicePath
      Cache-Control: no-cache

      {
      "entities": [

      { "type": "cameraSimple", "isPattern": "true", "id": "sensor03" }

      ],
      "attributes": [
      "class"
      ],
      "reference": "http://<cb_host>:8666/notify",
      "duration": "P1M",
      "notifyConditions": [

      { "type": "ONCHANGE", "condValues": [ "class" ] }

      ],
      "throttling": "PT5S"
      }

      I receive following answer:

      {
      "subscribeResponse":

      { "subscriptionId": "588b4f38e2066a50fa98df9b", "duration": "P1M", "throttling": "PT5S" }

      }

      but on the Fiware server, i see an error about the conditions in the terminal running the containers, and another one about the attributes:

      orion | ERROR@14:06:10 safeMongo.cpp[302]: Runtime Error (field 'conditions' was supposed to be an array but type=4 in BSONObj <{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://<cb_host>:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [

      { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false }

      ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression:

      { q: "", mq: "", geometry: "", coords: "", georel: "" }

      , format: "JSON" }> from caller mongoSubCacheItemInsert:221)
      orion | ERROR@13:48:10 safeMongo.cpp[302]: Runtime Error (field 'attrs' was supposed to be an array but type=4 in BSONObj <{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://<cb_host>:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [

      { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false }

      ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression:

      { q: "", mq: "", geometry: "", coords: "", georel: "" }

      , format: "JSON" }> from caller mongoSubCacheItemInsert:215)

      Also, when updating a value on my entity,

      PUT /v2/entities/sensor03/attrs/class/value HTTP/1.1
      Host: <cb_host>:1026
      Accept: application/json
      Fiware-Service: myService
      Fiware-ServicePath: /myServicePath
      Cache-Control: no-cache

      "monitor"

      I get nothing when querying the STH:

      GET /STH/v1/contextEntities/type/myDevice/id/sensor03/attributes/class?lastN=10 HTTP/1.1
      Host: <cb_host>:8666
      Accept: application/json
      Fiware-Service: myService
      Fiware-ServicePath: /myServicePath
      Cache-Control: no-cache

      returns:

      {
      "contextResponses": [
      {
      "contextElement": {
      "attributes": [

      { "name": "class", "values": [] }

      ],
      "id": "sensor03",
      "isPattern": false,
      "type": "myDevice"
      },
      "statusCode":

      { "code": "200", "reasonPhrase": "OK" }

      }
      ]
      }

      Note:

      I use NGSI V1, as I suspect V2 is not yet supported for STH receiving NGSI V2 notifications regarding this issue.
      Also i didn't find any documentation regarding "Getting historical raw context information" with NGSI V2, e.g on this page
      I use Docker-machine with a singl debian 8 VM running on Fiware-Lab with following images:

      mongodb:
      image: mongo:2.6
      hostname: mongodb
      container_name: mongodb
      command: --smallfiles

      orion:
      image: fiware/orion:develop
      hostname: orion
      container_name: orion
      links:

      • mongodb
        expose:
      • "1026"
        ports:
      • "1026:1026"
        command: -dbhost mongodb

      fiware-sth-comet:
      image: telefonicaiot/fiware-sth-comet
      links:

      • mongodb
        ports:
      • "8666:8666"
        environment:
      • STH_HOST=0.0.0.0
      • DB_URI=mongodb:27017

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        2d 20h 59m 1 Backlog Manager 30/Jan/17 3:05 PM
        In Progress In Progress Answered Answered
        3h 1 Backlog Manager 30/Jan/17 6:05 PM
        Answered Answered Closed Closed
        8d 18h 35m 1 Fermín Galán 08/Feb/17 12:40 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        fermin Fermín Galán made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        fla Fernando Lopez made changes -
        HD-Enabler Orion [ 10875 ]
        Description
        Created question in FIWARE Q/A platform on 27-01-2017 at 15:01
        {color: red}Please, ANSWER this question AT{color} http://stackoverflow.com/questions/41895831/fiware-orion-context-broker-subscription-v1-conditions-was-supposed-to-be-an


        +Question:+
        Fiware - Orion Context Broker subscription V1, &quot;conditions was supposed to be an array&quot;

        +Description:+
        When trying to use STH to be able to store and retrieve data sent to OCB, I have a problem making the subscription.

        My problem is that the subscription creation goes well.
        When I create the subscription as following:

        POST /v1/contextSubscriptions HTTP/1.1
        Host: &lt;cb_host&gt;:1026
        Content-Type: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache

        {
          "entities": [
            {
              "type": "cameraSimple",
              "isPattern": "true",
              "id": "sensor03"
            }
          ],
          "attributes": [
            "class"
            ],
          "reference": "http://&lt;cb_host&gt;:8666/notify",
          "duration": "P1M",
          "notifyConditions": [
            {
              "type": "ONCHANGE",
              "condValues": [
                "class"
                ]
            }
          ],
            "throttling": "PT5S"
        }


        I receive following answer:

        {
          "subscribeResponse": {
            "subscriptionId": "588b4f38e2066a50fa98df9b",
            "duration": "P1M",
            "throttling": "PT5S"
          }
        }


        but on the Fiware server, i see an error about the conditions in the terminal running the containers, and another one about the attributes:

        orion | ERROR@14:06:10 safeMongo.cpp[302]: Runtime Error (field 'conditions' was supposed to be an array but type=4 in BSONObj &lt;{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://&lt;cb_host&gt;:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [ { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false } ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression: { q: "", mq: "", geometry: "", coords: "", georel: "" }, format: "JSON" }&gt; from caller mongoSubCacheItemInsert:221)
        orion | ERROR@13:48:10 safeMongo.cpp[302]: Runtime Error (field 'attrs' was supposed to be an array but type=4 in BSONObj &lt;{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://&lt;cb_host&gt;:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [ { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false } ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression: { q: "", mq: "", geometry: "", coords: "", georel: "" }, format: "JSON" }&gt; from caller mongoSubCacheItemInsert:215)


        Also, when updating a value on my entity,

        PUT /v2/entities/sensor03/attrs/class/value HTTP/1.1
        Host: &lt;cb_host&gt;:1026
        Accept: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache

        "monitor"


        I get nothing when querying the STH:

        GET /STH/v1/contextEntities/type/myDevice/id/sensor03/attributes/class?lastN=10 HTTP/1.1
        Host: &lt;cb_host&gt;:8666
        Accept: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache


        returns:

        {
          "contextResponses": [
            {
              "contextElement": {
                "attributes": [
                  {
                    "name": "class",
                    "values": []
                  }
                ],
                "id": "sensor03",
                "isPattern": false,
                "type": "myDevice"
              },
              "statusCode": {
                "code": "200",
                "reasonPhrase": "OK"
              }
            }
          ]
        }


        Note:


        I use NGSI V1, as I suspect V2 is not yet supported for STH receiving NGSI V2 notifications regarding this issue.
        Also i didn't find any documentation regarding "Getting historical raw context information" with NGSI V2, e.g on this page
        I use Docker-machine with a singl debian 8 VM running on Fiware-Lab with following images:

        mongodb:
            image: mongo:2.6
            hostname: mongodb
            container_name: mongodb
            command: --smallfiles

        orion:
            image: fiware/orion:develop
            hostname: orion
            container_name: orion
            links:
              - mongodb
            expose:
              - "1026"
            ports:
              - "1026:1026"
            command: -dbhost mongodb

        fiware-sth-comet:
            image: telefonicaiot/fiware-sth-comet
            links:
              - mongodb
            ports:
              - "8666:8666"
            environment:
              - STH_HOST=0.0.0.0
              - DB_URI=mongodb:27017


        Created question in FIWARE Q/A platform on 27-01-2017 at 15:01
        {color: red}Please, ANSWER this question AT{color} http://stackoverflow.com/questions/41895831/fiware-orion-context-broker-subscription-v1-conditions-was-supposed-to-be-an


        +Question:+
        Fiware - Orion Context Broker subscription V1, &quot;conditions was supposed to be an array&quot;

        +Description:+
        When trying to use STH to be able to store and retrieve data sent to OCB, I have a problem making the subscription.

        My problem is that the subscription creation goes well.
        When I create the subscription as following:

        POST /v1/contextSubscriptions HTTP/1.1
        Host: &lt;cb_host&gt;:1026
        Content-Type: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache

        {
          "entities": [
            {
              "type": "cameraSimple",
              "isPattern": "true",
              "id": "sensor03"
            }
          ],
          "attributes": [
            "class"
            ],
          "reference": "http://&lt;cb_host&gt;:8666/notify",
          "duration": "P1M",
          "notifyConditions": [
            {
              "type": "ONCHANGE",
              "condValues": [
                "class"
                ]
            }
          ],
            "throttling": "PT5S"
        }


        I receive following answer:

        {
          "subscribeResponse": {
            "subscriptionId": "588b4f38e2066a50fa98df9b",
            "duration": "P1M",
            "throttling": "PT5S"
          }
        }


        but on the Fiware server, i see an error about the conditions in the terminal running the containers, and another one about the attributes:

        orion | ERROR@14:06:10 safeMongo.cpp[302]: Runtime Error (field 'conditions' was supposed to be an array but type=4 in BSONObj &lt;{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://&lt;cb_host&gt;:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [ { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false } ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression: { q: "", mq: "", geometry: "", coords: "", georel: "" }, format: "JSON" }&gt; from caller mongoSubCacheItemInsert:221)
        orion | ERROR@13:48:10 safeMongo.cpp[302]: Runtime Error (field 'attrs' was supposed to be an array but type=4 in BSONObj &lt;{ _id: ObjectId('588b4f96e2066a50fa98df9c'), expiration: 1488116886, reference: "http://&lt;cb_host&gt;:8666/notify", custom: false, throttling: 5, servicePath: "/myServicePath", status: "active", entities: [ { id: "sensor03", isPattern: "true", type: "cameraSimple", isTypePattern: false } ], attrs: [ "class" ], metadata: [], blacklist: false, conditions: [ "class" ], expression: { q: "", mq: "", geometry: "", coords: "", georel: "" }, format: "JSON" }&gt; from caller mongoSubCacheItemInsert:215)


        Also, when updating a value on my entity,

        PUT /v2/entities/sensor03/attrs/class/value HTTP/1.1
        Host: &lt;cb_host&gt;:1026
        Accept: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache

        "monitor"


        I get nothing when querying the STH:

        GET /STH/v1/contextEntities/type/myDevice/id/sensor03/attributes/class?lastN=10 HTTP/1.1
        Host: &lt;cb_host&gt;:8666
        Accept: application/json
        Fiware-Service: myService
        Fiware-ServicePath: /myServicePath
        Cache-Control: no-cache


        returns:

        {
          "contextResponses": [
            {
              "contextElement": {
                "attributes": [
                  {
                    "name": "class",
                    "values": []
                  }
                ],
                "id": "sensor03",
                "isPattern": false,
                "type": "myDevice"
              },
              "statusCode": {
                "code": "200",
                "reasonPhrase": "OK"
              }
            }
          ]
        }


        Note:


        I use NGSI V1, as I suspect V2 is not yet supported for STH receiving NGSI V2 notifications regarding this issue.
        Also i didn't find any documentation regarding "Getting historical raw context information" with NGSI V2, e.g on this page
        I use Docker-machine with a singl debian 8 VM running on Fiware-Lab with following images:

        mongodb:
            image: mongo:2.6
            hostname: mongodb
            container_name: mongodb
            command: --smallfiles

        orion:
            image: fiware/orion:develop
            hostname: orion
            container_name: orion
            links:
              - mongodb
            expose:
              - "1026"
            ports:
              - "1026:1026"
            command: -dbhost mongodb

        fiware-sth-comet:
            image: telefonicaiot/fiware-sth-comet
            links:
              - mongodb
            ports:
              - "8666:8666"
            environment:
              - STH_HOST=0.0.0.0
              - DB_URI=mongodb:27017


        HD-Chapter Data [ 10838 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-01-30 18:05|UPDATED status: transition Answered| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2017-01-30 18:05|UPDATED status: transition Answered| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        fla Fernando Lopez made changes -
        Assignee Fermín Galán [ fermin ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-01-30 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2017-01-30 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-01-27 18:05|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2017-01-27 18:05|CREATED monitor | # answers= 0, accepted answer= False
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            fermin Fermín Galán
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: