此处描述的错误来自Orion Context Broker和Mongo Server的最新版本。
查询POST
http://127.0.0.1:1026/v1/updateContext
Accept: application/json
Content-Type: application/json
{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "Room2",
"attributes": [
{
"name": "temperature",
"type": "float",
"value": "15.90"
},
{
"name": "pressure",
"type": "integer",
"value": "1021"
}
]
}
],
"updateAction": "APPEND"
}
ORION日志:
INFO@16:44:47 rest.cpp[768]: Starting transaction from
127.0.0.1:43181/v1 /updateContext INFO@16:44:47
MongoCommonUpdate.cpp[1657]: Database Operation Successful ({
_id.id: "Room4", _id.type: "Room", _id.servicePath: /^\/$|^\/\/.*/
})
INFO@16:44:47 MongoCommonUpdate.cpp[1454]: Database Operation
Successful (insert { _id: { id: "Room4", type: "Room", servicePath:
"/" }, attrs: [ { name: "temperature", type: "float", creDate:
1430844287, modDate: 1430844287, value: "21" }, { name: "pressure",
type: "integer", creDate: 1430844287, modDate: 1430844287, value:
"711" } ], creDate: 1430844287, modDate: 1430844287 }) Tue May 5
18:44:47 DBClientCursor::init call() failed
ERROR@16:44:47 MongoCommonUpdate.cpp[930]: Database Error (collection:
orion.csubs - query(): { $or: [ { entities.id: "Room4", $or: [ {
entities.type: "Room" }, { entities.type: { $exists: false } } ],
entities.isPattern: "false", conditions.type: "ONCHANGE",
conditions.value: "temperature", expiration: { $gt: 1430844287 },
servicePath: { $in: [ /^$|^/#$|^/$/, null ] } }, { entities.isPattern:
"true", conditions.type: "ONCHANGE", conditions.value: "temperature",
expiration: { $gt: 1430844287 }, servicePath: { $in: [ /^$|^/#$|^/$/,
null ] }, $where: function(){for (var i=0; i < this.entities.length; i++)
{if (this.enti... } ] } - exception: Null cursor from mongo (details on
this is found in the source code))
INFO@16:44:47 rest.cpp[382]: Transaction ended
如果我使用RestClient发出请求
响应:
Status Code: 200 OK
Content-Length: 856
Content-Type: application/xml
Date: Tue, 05 May 2015 16:44:47 GMT
回复机构:
<updateContextResponse>
<contextResponseList>
<contextElementResponse>
<contextElement>
<entityId type="Room" isPattern="false">
<id>Room4</id>
</entityId>
<contextAttributeList>
<contextAttribute>
<name>temperature</name>
<type>float</type>
<contextValue></contextValue>
</contextAttribute>
<contextAttribute>
<name>pressure</name>
<type>integer</type>
<contextValue></contextValue>
</contextAttribute>
</contextAttributeList>
</contextElement>
<statusCode>
<code>500</code>
<reasonPhrase>Internal Server Error</reasonPhrase>
<details>\"</details>
</statusCode>
</contextElementResponse>
</contextResponseList>
</updateContextResponse>
有时它会在数据库中生成实体,但总是会进入mongo