public:using_couchdb_for_temporal_data
While I was not able to find a easy to understand and implement solution, I decided to use below approach that is simple and appropriate for my use case (that's pretty complicated), I will try to present simpler example bellow:
- let's assume our use case implies a temperature reading sensor, a couchDB import script and a map function
- each m minutes (more or less - it should not matter) info is read from server and saved into couchDB
- each doc should have a metaData with two values: {validityStart: <timestamp>, validityEnd: <timestamp>)
- there are two kinds of DOCs:
- current doc, using sensorId as key and {validityStart: <timestamp>, validityEnd: 0)
- archived doc, using uuid as key and {validityStart: <timestamp>, validityEnd: <timestamp>)
- each time a reading is done,
- if existing reading already existing for this sensor:
- create new archived doc from current doc + updated validityEnd timestamp
- update/create current doc with new validityStart timestamp and new temperature
public/using_couchdb_for_temporal_data.txt · Last modified: by admin
