title: Models ref each other error: circular dependencies problem
body: <p>admin.model.ts</p>
  <pre><code>import mongoose, { Schema, Document } from 'mongoose';
  import UserRole, { IUserRole } from './user-role.model';
  
  export interface IAdmin extends Document {
      role: IUserRole;
  }
  
  let adminSchema = new Schema&lt;IAdmin&gt;({
      role: {
          type: Schema.Types.ObjectId, ref: UserRole
      }
  });
  
  export default mongoose.model&lt;IAdmin&gt;('Admin', adminSchema);
  </code></pre>
  <p>user-role.model.ts</p>
  <pre><code>import { Schema, Document, model } from 'mongoose';
  
  export interface IUserRole extends Document{
      updated_by: IAdmin|string;
  }
  
  let userRoleSchema = new Schema&lt;IUserRole&gt;({
      updated_by: {
          type: Schema.Types.ObjectId, ref: Admin
      }
  })
  
  export default model&lt;IUserRole&gt;('UserRole', userRoleSchema);
  </code></pre>
  <pre><code>MongooseError: Invalid ref at path &quot;updated_by&quot;. Got undefined
      at validateRef (/home/ess24/ess-smartlotto/node-rest/node_modules/mongoose/lib/helpers/populate/validateRef.js:17:9)
      at Schema.path (/home/ess24/ess-smartlotto/node-rest/node_modules/mongoose/lib/schema.js:655:5)
      at Schema.add (/home/ess24/ess-smartlotto/node-rest/node_modules/mongoose/lib/schema.js:535:14)
      at require (internal/modules/cjs/helpers.js:88:18)
  [ERROR] 22:25:54 MongooseError: Invalid ref at path &quot;updated_by&quot;. Got undefined
  </code></pre>
  <p>Here is my two model how can I solve this type of problem and how to deal with circular dependencies?</p>