node red MongoDB limit 需要整数

Node red MongoDB limit requires an integer

我正在尝试建立一个简单的物联网温度监控系统。 Node Red 似乎是一个不错的解决方案。

我在 ubuntu 16.04 上安装了 node red 和 mongodb。当我尝试将数据存储到 mongodb 中时,它存储成功,但是,当我尝试从我的数据库中获取数据时,我在调试选项卡上收到以下错误:MongoError: limit requires an integer

这是我的节点:

[{"id":"845a2d0f.f529f","type":"debug","z":"175fe64a.2e87ba","name":"","active":true,"console":"false","complete":"false","x":698,"y":118,"wires":[]},{"id":"37b967b4.5953a8","type":"http in","z":"175fe64a.2e87ba","name":"/iot request","url":"/iot","method":"get","swaggerDoc":"","x":229.9517059326172,"y":314.0511169433594,"wires":[["70d77b6c.c2f234"]]},{"id":"70d77b6c.c2f234","type":"mongodb in","z":"175fe64a.2e87ba","mongodb":"5b5bee5b.f2593","name":"retrieve hello","collection":"test","operation":"find","x":472.9545593261719,"y":356.5880432128906,"wires":[["3b3c5324.f2f78c"]]},{"id":"3b3c5324.f2f78c","type":"http response","z":"175fe64a.2e87ba","name":"show hello","x":760.960205078125,"y":311.91192626953125,"wires":[]},{"id":"ac92efad.22272","type":"mqtt in","z":"175fe64a.2e87ba","name":"get outtemp","topic":"/sensors/esp0/temp0","qos":"2","broker":"fd4c9ee3.0aa1a","x":193,"y":118,"wires":[["845a2d0f.f529f","63a9e917.39f568"]]},{"id":"63a9e917.39f568","type":"mongodb out","z":"175fe64a.2e87ba","mongodb":"5b5bee5b.f2593","name":"store temp","collection":"test","payonly":true,"upsert":false,"multi":false,"operation":"store","x":406,"y":219,"wires":[]},{"id":"5b5bee5b.f2593","type":"mongodb","z":"","hostname":"127.0.0.1","port":"27017","db":"testdb","name":""},{"id":"fd4c9ee3.0aa1a","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"200","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

我是一个完整的新手,节点红色和 mongodb,对 mqtt 有一些经验。

我该如何解决这个问题?

经过knolleary的指点,找到了This post on the node-red mail list

所以这就是我必须做的:

add a function before mongodb find block and enter in this function:

msg.limit = 5;
msg.skip = 0;
return msg;