views:

53

answers:

1

Hi there,

I'm a mongo + mongomapper newbie, my question is, after following the examples in these slides: 1. http://www.slideshare.net/mongosf/ruby-development-and-mongomapper-john-nunemaker/39 2. Slide 40 3. Slide 41

I ended up with 2 collections joined on a foreign id... Is that right? I was expecting to see something similar to what's on slide 41 instead I have 2 collections, Account and Site, and each 'site' stored as a separate doc in that collection... That's not right, right?

Any help appreciated.

(My db is in MongoHQ) (I have a hyperlink restriction because I'm newish here hence only the one link to the slides)

Hemal

A: 

For everything in one document I think that you want slides 42 to 45.

If you look at slide 41, each object has an account_id that references the parent Account object.

If you look at slide 45, you'll see that one object is "embedded" within the other.

This will require only one collection instead of two, so this is probably what you want.

Gates VP