UHU
UHU

Reputation: 55

Store sensor data in MongoDB

I'm working with Raspberry Pi trying to send the sensor data by using REST API back to Node.js (Express) and then store or update data inside MongoDB overtime. Since I have to work with many devices, how can I store data accordingly to its device. Is it a good idea to override objectId as raspberry pi serial no. and request POST/PUT to update its data overtime.

Upvotes: 0

Views: 624

Answers (1)

Muhammad Shaharyar
Muhammad Shaharyar

Reputation: 1104

You can add Device key in the model of database.

So for every device there will be a separate document with its own information (unique or having your raspberry pi serial no) .

You can edit/delete etc the particular document by referencing Device without interrupting mongoose ObjectId

Upvotes: 1

Related Questions