I've been reading a bit about document design for MongoDB, specifically relating to referencing, embedding and linking.
I'm still not sure what the best layout would be for the kind of documents I wish to store.
Imagine if you will, a type of dynamic form building application. Each form will have a set of static attributes (name, description, etc), a set of dynamically created fields (name = text, age = number, etc), and a set of submitted results.
Something like this:
$obj = array(
'name' => 'Test',
'description' => 'Hello',
'live' => false,
'meta' => array (
'name' => 'text',
'age' => 'number',
'sex' => 'boolean',
),
'records' => array(
array('name' => 'Test', 'age' => 20, 'sex' => true),
...
...
)
);
My confusion mainly comes from whether I should be embedding the records within the collection, or if I should create individual collections for each form. My intuition is to do the latter, while the MongoDB books I have been reading state that embedding data is ok.
Can someone please assist, given that I expect forms to have large quantities of submitted data.
Thanks.
Edit: I also found this question to be helpful.