views:

202

answers:

1

I am using Rails and have to store 4 Models. Let's say a Post that has many and belongs to many Categories. Category on the other hand has many Qualities. At the moment I'm of the opinion, that Post and Categories are Documents. Qualities becomes an embedded Document of Categories.

We're coming to the root problem: There are a lot of Votes on Qualities that belong to a Post. I thought about embed Votes in Post and give it a quality_id.

I am really expecting a lot of Votes and there has to be a possibility to filter them (e.g by Username / Usergroup / Date voted). I worked with MongoMapper and I think the missing existence of find methods for embedded Documents could become a killer. What if I want to provide a Post without all the Votes, but only a few.

On the other hand I'm worrying about performance issues. What if I define an own Document for Votes and have tons of Vote-Documents?

A: 

There are no join in MongoDB so have a embedded document is interesting if you see always this document in his parent.

You can search by embedded document with MongoDB, so no problem if you want limit to all Qualities with a lot of votes.

shingara