|< < 35 > >|

MongoDB Data Model

JSON documents

Diaspora's experience with the MongoDB data model

Don't duplicate data

We can represent this in MongoDB in a couple of different ways. Duplication is an easy option. ...

You can see why this is attractive: all the data you need is already located where you need it.

You can also see why this is dangerous. Updating a user's data means walking through all the activity streams that they appear in to change the data in all those different places. This is very error-prone, and often leads to inconsistent data and mysterious errors, particularly when dealing with deletions. [Especially since MongoDB has no transactions!]

|< < 35 > >|