我正在使用FIWARE平台上的LWM2M设备(使用Orion CB)在IoT上建立演示。但是,lightweightm2m-iotagent无法连接到mongodb。知道为什么会这样吗?以下是我遇到的错误:
{
"message": "Cannot read property 'findOne' of undefined",
"name": "TypeError"
}
我正在使用docker-compose文件(如下)启动所有服务。
version: "3.1"
services:
mongo:
image: mongo:3.2
command: --nojournal
ports:
- "27017:27017"
expose:
- "27017"
orion:
image: fiware/orion
links:
- mongo
ports:
- "1026:1026"
command: -dbhost mongo -logLevel DEBUG
depends_on:
- mongo
expose:
- "1026"
lightweightm2m-iotagent:
image: telefonicaiot/lightweightm2m-iotagent
hostname: idas
links:
- orion
expose:
- "4041"
- "5684"
ports:
- "4041:4041"
- "5684:5684/udp"
mosquitto:
image: ansi/mosquitto
ports:
- "1883:1883"
expose:
- "1883"
答案 0 :(得分:1)
通过添加以下内容(在lightmm2m-iotagent定义中)解决了该问题
environment:
- IOTA_MONGO_HOST=mongo