Skip to content

Introduction

hobbyquaker edited this page Sep 30, 2017 · 29 revisions

This is a NoSQL Database, to be precise: a JSON Document Store with MQTT interface, CouchDB/MapReduce inspired Views, implemented in Node.js. (Yeah, Buzzword Bingo! 🤠)


You can create and modify documents by publishing JSON payloads to MQTT and receive document changes by simply subscribing to certain topics. You can create views by defining map and reduce functions and filter document ids with MQTT style wildcards.

Note that this project is not associated with or endorsed by http://mqtt.org

Intention

It's intended to be used as a database for storing metadata in systems that use MQTT as message bus.

One could ask:

Why don't you just use SQLite, Postgres, CouchDB, MongoDB, you name it, ...?

I built a lot of MQTT interfaces - let's call them xy2mqtt - following the mqtt-smarthome architectural proposal. These interfaces are connecting a multitude of different devices to an MQTT broker and are the building blocks of my smart home automation system. In the past the system had no knowledge of the device types and their specific characteristics, there was just a bunch of unordered MQTT topics that demand different payloads and values to control a device.

To be able to e.g. automatically create a user interface for these devices the need for some metadata arose, the system has to know which devices exist, what they can do, if they belong to some room, which ui controls can be used to control them, on which topics they are publishing/subscribing and what payloads and values they expect. This metadata has to be stored somewhere, this is where mqttDB comes in.

Because I didn't want to enlarge the xy2mqtt services by implementing another extra protocol for the database, I decided to just stick to MQTT. I think this approach is more simplistic and convenient for me and fits better to the mqtt-smarthome concept where MQTT is the one and only message bus that connects everything.

Last but not least this project serves also an educational purpose and gives me fun, I like to try out and learn new things. 🤓

What is special about mqttDB?

The main difference to other databases is that a client does not have to explicitly query for documents or views, the client just subscribes to the documents/views that are of interest and any updates of these documents and views are published to MQTT by mqttDB and reach the clients in the usual MQTT "push manner".

Everything fine? No downsides with that approach?

Uhm. Depends. See the Section Performance.


Proceed to Install.

Clone this wiki locally