title: Mongoose schema reference and undefined type 'ObjectID'
body: <p>I'm trying to do some relations between my schemas and I have some problems with my solution.
  Here is my device schema:</p>
  
  <pre><code>var deviceSchema = schema({
      name : String,
      type : String,
      room: {type: mongoose.Types.ObjectId,  ref: 'Room'},
      users: [{type:mongoose.Types.ObjectId, ref: 'User'}]
  });
  </code></pre>
  
  <p>and here room schema:</p>
  
  <pre><code>var roomSchema = schema({
      name : String,
      image : String,
      devices: [{type: mongoose.Types.ObjectId, ref: 'Device'}]
  });
  </code></pre>
  
  <p>Mongoose throws error</p>
  
  <blockquote>
    <p>TypeError: Undefined type <code>ObjectID</code> at <code>room</code>   Did you try nesting
    Schemas? You can only nest using refs or arrays.</p>
  </blockquote>
  
  <p>If I change <code>room: {type: mongoose.Types.ObjectId,  ref: 'Room'},</code> to <code>room: {type: Number,  ref: 'Room'},</code> everything works. Could you explain me why this is happening?</p>