title: Loopback 4/MongoDB - Foreign key not converted to ObjectID
body: <p>I am trying to set up an hasMany relation using a Mongo database.
  I have followed the guide to create an hasMany relation in the loopback 4 documentation (<a href="https://loopback.io/doc/en/lb4/HasMany-relation.html" rel="noreferrer">https://loopback.io/doc/en/lb4/HasMany-relation.html</a>) and tryied to set differents properties but the foreign key custId is saved as a string and not as an ObjectID. </p>
  
  <p>I also found a few other properties or options from others topics but people were using Loopback 3 and it doesn't seem to work with Loopback 4.</p>
  
  <p>Did I miss something or is there any workaround ? </p>
  
  <p>Here are my models :</p>
  
  <pre><code>@model()
  export class Order extends Entity {
    @property({
      type: 'string',
      id: true,
      generated: true,
    })
    id: string;
  
    @property({
      type: 'array',
      itemType: 'string',
      required: true,
    })
    product: string[];
  
    @property({
      type: 'number',
      required: true,
    })
    price: number;
  
    @property({
      type: 'string',
      id: true,
      generated: true,
    })
    custId: string;
  
    constructor(data?: Partial&lt;Order&gt;) {
      super(data);
    }
  }
  
  
  @model()
  export class Customer extends Entity {
     @property({
        type: 'string',
        id: true,
        generated: true,
     })
     id: string;
  
     @property({
      type: 'string',
      required: true,
    })
    name: string;
  
    @property({
      type: 'string',
    })
    adress?: string;
  
    @hasMany(() =&gt; Order, {keyTo: 'custId'})
      orders?: Order[];
  
    constructor(data?: Partial&lt;Customer&gt;) {
      super(data);
    }
  }
  </code></pre>