fiware - Using Cygnus to write in mongo db with no string
问题描述
I'm trying to use Orion CB and Cygnus to write information about water quality and water consume and I need to write in float type. However it is impossible to me to know if there is any possibility to write this with float or double format. Could someone tell me if this possibility exists?
解决方案
如FIWARE Orion 文档中所述,您可以使用 JSON 格式自由指定实体属性。
因此,您将拥有以下格式的实体:
{
"id": "entityID",
"type": "entityType",
"attr_1": <val_1>,
"attr_2": <val_2>,
...
"attr_N": <val_N>
}
其中每个<val_n>
将采用以下格式:
{
"type": <...>,
"value": <...>,
"metadata": <...>
}
因此,您可以将某些实体描述为,例如:
{
"id": "sensor_ID",
"type": "room_sensor",
"temperature": {
"type": "float",
"value": 23.2
},
"noise": {
"type": "integer",
"value": 35
}
}
因此,您可以根据需要使用 float 或 double。
推荐阅读
- bash - 不断变化的变量
- python - 在 k 个子集中拆分列表而不改变顺序
- c# - 如何指定可观察序列之间的依赖关系?
- angular - 如何使用 Angular 将动画设置为 Nebular Stepper,就像 Material 一样
- javascript - 在javascript中单击正文或窗口中的相同元素删除元素
- tensorflow - MLflow 服务于 tensorflow.keras.wrappers.scikit_learn KerasClassifier 模型
- python - 通过 python 请求发出请求时出现错误 400,但在 cURL 中有效
- perl - 在 Moose 中,我如何对 arrayref 设置器进行 uniq?
- performance - 在 Aurora-mysql 中插入大量数据时的性能问题
- java - Stack implementation using LinkedList in Java