Details
- 
        Type:Monitor 
- 
        Status: Closed
- 
            Priority: Major Major
- 
            Resolution: Done
- 
            Affects Version/s: None
- 
            Fix Version/s: 2021
- 
            Component/s: FIWARE-TECH-HELP
- 
            Labels:
- 
                        HD-Chapter:Data
- 
                        HD-Enabler:Orion
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": [
  ],
  "attributes": [ 
    "class" 
    ],
  "reference": "http://<cb_host>:8666/notify",
  "duration": "P1M",
  "notifyConditions": [
  ],
    "throttling": "PT5S"
}
I receive following answer:
{
  "subscribeResponse": 
}
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: [ 
], 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": [
        ],
        "id": "sensor03",
        "isPattern": false,
        "type": "myDevice"
      },
      "statusCode": 
    }
  ]
}
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
| Field | Original Value | New Value | 
|---|---|---|
| Component/s | FIWARE-TECH-HELP [ 10278 ] | 
| Status | Open [ 1 ] | In Progress [ 3 ] | 
| Assignee | Fermín Galán [ fermin ] | 
| Status | In Progress [ 3 ] | Answered [ 10104 ] | 
| 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, "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 | 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, "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 | 
| HD-Chapter | Data [ 10838 ] | 
| Resolution | Done [ 10000 ] | |
| Status | Answered [ 10104 ] | Closed [ 6 ] | 
| Fix Version/s | 2021 [ 12600 ] | 
| Transition | Time In Source Status | Execution Times | Last Executer | Last Execution Date | |||||
|---|---|---|---|---|---|---|---|---|---|
| 
 | 2d 20h 59m | 1 | Backlog Manager | 30/Jan/17 3:05 PM | |||||
| 
 | 3h | 1 | Backlog Manager | 30/Jan/17 6:05 PM | |||||
| 
 | 8d 18h 35m | 1 | Fermín Galán | 08/Feb/17 12:40 PM | 
 
	 
		                 
	 
	 
	
2017-01-27 18:05|CREATED monitor | # answers= 0, accepted answer= False