'Mongoose ToId Types add more than one Id in objectArray

So for example I have a Car and I want to do relation with 2 owners with Mogoose Types but I'm getting this error: BSONTypeError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters

This is how I'm trying to fill the array:

vehicles = toId([
 '6200d870c6d4758d29a86bed',
 '620b45cacddc8898b8919f3d',
]);

And here is my model:

vehicles: [
      {
        type: Types.ObjectId,
        ref: 'vehicle',
        default: null,
      },
    ],


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source