We are now choosing a database for a project. The candidates are mongodb and postgres. Our users need to define conditional logic, e.g. user defines conditions (as strings) "x happens", "y leaves" etc, and can then concatenate them to conditions "if x happens AND (y leaves OR z comes)...".
Doing it in a single json document seems much more readable than in a relational database.
Do you see any way to model this reasonably in postgres? I know postgres 9.2 will support json but the querying capabilities seem clunky.
In mongo the verbs ("x happens") will be duplicated between the conditions. A verb update will affect multiple rows. Do you see a problem here?
EDIT: the mongo documents may look like this:
{
"where":
[1,"x happens"],
"and":
{ "where":
[2,"y leaves"],
"or":
[3,"z comes"]
}
}