Connecting RPI Gateway to MongoDB

I’am trying to connect the RPI gateway to mongoDB in hope of sending the location and distance of the node , So i think there is two ways for doing this.
1-connecting through the MQTT broker then passing data to MongoDB
2-Sending data directly to MongoDB

I’am trying to send data directly to MongoDB and i noticed that it won’t download MongoDB on raspberry Pi , this error pops up “mongod.service could not be found” and when i try to update RPI by the command “sudo apt update && sudo apt upgrade -y” it will stop updating after a while and failing to update certain packages , and after that the partial update the Web manager will stop visualising nodes and when i disconnect the RPI it will not be able to connect to the Wifi though creating the file “wpa_supplicant.conf”. It will only connect when i erase the old image and Flash it again with DRTLS RPI Firmware and starting from scratch

Does anyone had the same issue or tried the same procedure ?
Is updating RPI firmware is the direct cause of the malfunction of the setup?
How can connect to mongoDB without crashing the dateway Firmware

Hi @azizraw
the DRTLS RPi image is a quite old and the raspbian is indeed outdated. However do not upgrade (update might be ok) the provided image a it will also replace the kernel and the internal dwm.ko kernel module will be not compatible with the newer kernel and it wont load/work anymore.

So I think that in your use case the 1. approach will be the best - crease a mini app that will connect to MQTT broker and forward it to the MongoDB.

One side not: For any kind of databases that store data on to disk - you need to be careful with SD cards as it could easily kill SD card due to many rewrites.


thank you for replying,
by mini app you mean external app or python program that manipulate data from raspberry MQTT and send it to mongodb and did anyone tried to accomplish this and if there is any record of someone connecting the dwm Raspberrypi gateway to MongoDB

Hi @azizraw
yen I mean they you need to write your app which connects to MQTT and forward he data to MognoDB.

Im not familiar with MongoDB - but after a bit of googling you should check this: GitHub - izmailoff/mqtt-mongo: A generic service that subscribes to MQQT broker and saves messages to MongoDB.