I am contemplating the design of an event logging system based on couchDB.
What would be a good way of storing each event?
- one document with events as 'attachments'
- one document per event
- one document per event-type, events as attachments
Other?
I am contemplating the design of an event logging system based on couchDB.
What would be a good way of storing each event?
Other?
I would set one document for event. If it is event logging system, event is main entity, right? So IMHO it should be document, not just some attachment. This solution gives you flexibility when searching/filtering events.
I would definitely go for one document per event too. In addition to amorfis's answer, using attachments is likely to lead to contention over the document during updates unless you serialise updates very carefully. Just throw events into couchdb as documents as they happen and use views to slice and dice the events for analysis.