[ https://jira.fiware.org/browse/HELP-8188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fermín Galán resolved HELP-8188. -------------------------------- Resolution: Done > [fiware-stackoverflow] Fiware - Orion Context Broker subscription V1, "conditions was supposed to be an array" > ------------------------------------------------------------------------------------------------------------------------ > > Key: HELP-8188 > URL: https://jira.fiware.org/browse/HELP-8188 > Project: Help-Desk > Issue Type: Monitor > Components: FIWARE-TECH-HELP > Reporter: Backlog Manager > Assignee: Fermín Galán > Labels: fiware, fiware-orion, fiware-sth-comet > > 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 at 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 at 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 -- This message was sent by Atlassian JIRA (v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy