Hello,
I'm looking for some advice on using CouchTypes. I'm writing a small garden tracking app which keep track of plantings in a garden. Each planting has multiple actions. These actions exist only within the scope of the planting. The same pattern is repeated for harvests and observations. Accordingly, I've sketched out the following document schema (I've greyed out parts of the schema irrelevant to this question)
{
"_id": "6edde3e99053a9ce2a660a9ea91d34d8",
"_rev": "3-577c45c66468cbb45e1f38e3b011bf38",
"user": "andru",
"type": "planting",
"place": "6edde3e99053a9ce2a660a9ea91d4193",
"plant": "Mustard Greens",
"actions": [
{
"type": "sowed",
"date": "2013-04-05 10:00:00",
"notes": "Was a really hot, dry day."
},
{
"type": "thinned",
"date": "2013-04-05 10:00:00",
"notes": "Thinned out and transplanted the thinnings."
}
],
"harvest": {
"began": "2013-05-27",
"ended": "2013-07-20",
"harvests": [
{
"date": "2013-06-06",
"yield": "10",
"unit": "heads",
"notes": "Heads were a bit on the small side"
}
]
},
"observations": [
{
"date": "2013-06-12",
"notes": "First seedlings popped their heads up"
},
{
"date": "2013-06-20",
"notes": "Argh! Total flea beetle massacre!"
}
]
}
How is this best achieved with CouchType fields? Looking over the source I can't see anything obvious I should use to allow an array with arbitrary objects, let alone an array of objects with some form of schema control.
I'd prefer to avoid using an EmbeddedList here, unless there are good reasons for that I'm missing, as the data in these objects is only relevant to this planting, and creating them as separate objects seems like an unnecessary schema complication.
Andru