tags:

views:

24

answers:

0

Hi, I have a project I'm working on and I want to use MongoDb.

Description: The programme is a questionnaire for an entity. The entity can be college, faculty or department. A form is captured per year for any of these entities though mostly departments. Queries can be made on any of them. Where needed, the data can be aggregated and used in ranking.

Relationship: Colleges contain faculties and faculties contain department. Each of them (well departments at the moment has forms). There can be a number of form types (3 at the moment)

Problem: How do I represent this scenario in MongoDb? First is the College > Faculty > Department relationship. How do I effectively represent this?

My current thoughts: 1. Concerning the College > Faculty > Department data, I was thinking I could use a single collection and tag them according:

{name:'Department X', tags: ['department'], parent: '???'}

. The parent could be the id of thee parent element so in this case the id of the associated department. The other option was

colleges: {name: 'some college',etc,faculties: [{name: 'some faculty', etc, departments: [{...}]}].

The issue was the id I would use to identify each ,eg, department.

  1. For the forms, I'm still not sure. If I embed the data in the department records, how easy will it be to retrieve for a number of departments, say in a faculty and do some sumation on most of the fields (most are number)?

Really need some assistance here coming from a relational background. I'm using c# with CSMongo by Hugo.

Regards, Richard