title: Is it possible to store multiple types of Objects into 1 mongodb collection?
body: <p><em>using document oriënted database mongodb and the Object Document Mapper (ODM) morphia</em></p>
  
  <p>Lets say we have 3 different classes; <code>Object</code>, <code>Category</code> and <code>Action</code>.<br>
  These object are all stored in the collections; objects, categories and actions.  </p>
  
  <p><code>Category</code> and <code>Action</code> are references of <code>Object</code></p>
  
  <pre><code>@Entity("objects")
  public class Object {
  
      @Id
      @Property("id")
      private ObjectId id;
  
      @Reference
      private Category category;
      private Action action;
      ...
  }
  
  @Entity("categories")
  public class Category {
  
      @Id
      public String categoryTLA;
      public String categoryName;
      ...
  }
  
  @Entity("actions")
  public class Action implements BaseEntity {
  
      @Id
      public String action;
      public int accesLevel;
      ...
  }
  </code></pre>
  
  <p>The documents with the current implementation are stored like:  </p>
  
  <ul>
  <li>Mongo <strong><em>(Server/location)</em></strong>
  
  <ul>
  <li>store <strong><em>(database)</em></strong>
  
  <ul>
  <li>objects <strong><em>(collection)</em></strong>
  
  <ul>
  <li>object <strong><em>(document)</em></strong></li>
  <li>object</li>
  <li>object</li>
  </ul></li>
  <li>categories
  
  <ul>
  <li>categorie</li>
  <li>categorie</li>
  <li>categorie</li>
  </ul></li>
  <li>actions
  
  <ul>
  <li>action</li>
  <li>action</li>
  <li>action</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Is it possible to store 2 different Objects, in this case <code>Category</code> and <code>Action</code>, in one collection, like shown in the next example? Both with their own identification! </p>
  
  <ul>
  <li>Mongo
  
  <ul>
  <li>store
  
  <ul>
  <li>objects
  
  <ul>
  <li>object</li>
  <li>object</li>
  <li>object</li>
  </ul></li>
  <li><strong><em>settings</em></strong>
  
  <ul>
  <li>categorie</li>
  <li>categorie</li>
  <li>categorie</li>
  <li>action</li>
  <li>action</li>
  <li>action</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>