mongoid/mongoid — Issue #1492: Database design problem
Author: danpersa
Created: 2011-12-12 15:11:45+00:00
State: open

Hello,

I want to design a database looking like this:

```javascript
User {
ideas: [
{ _id: ...
privacy: 'private'
reminders: [
{ _id: ...
reminder_date: ...
}, ...
]}
]
}

Idea {
content: 'this is an idea'
privacy: 'public'
users_who_liked_the_idea: [
user1id, user2id, ...
]
}
```

I'll try to explain what I'm trying to do:
We have three business objects: User, Idea and Reminder.

The User, which embeds some ideas. Every embedded idea has a privacy and an Array of reminders.
On the other part the Idea has some references to some users (and this is not the inverse relationship for the User embedded ideas).

As a briefing, what I'd like to do, is storing some information for the Idea entity as embedded data inside the User, but other information as different table, to avoid duplication of Arrays.

Which is the best idea to model this using Mongoid?

Thank you in advance,
Dan