Updating validator of existing collection in MongoDB 4.13

I am currently using MongoDB 4.13 and need to update the validator of an existing collection. However, it looks like the runCommand method is not recommended for this task in MongoDB 4.13.

I am not using any ORMs like Mongoose, and I am wondering what the best approach is to update the validator of an existing collection in MongoDB 4.13.

Does anyone have experience with updating the validator of an existing collection in MongoDB 4.13 without using the runCommand method? If so, could you share an example of how to do this?

In case the runCommand method is the only solution, do you recommend implementing it like this?

try {
  const collExists = (await this._db.listCollections().toArray()).some(
    (col) => col.name === this._collectionName
  );
  if (collExists) {
    return this._db.runCommand({
      collMod: this._collectionName,
      ...this._validator
    });
  }

  return this._db.createCollection(this._collectionName, this._validator);
} catch (err) {
  throw new Error(err.message);
}

Thank you in advance for any help you can provide!

can somebody assist me please?