code: function stringToBinaryUUID(value) {
      // for compatiblity reason check if value is already converted...
      if (typeof value !== "string") {
          return value;
      }
      const hex = value.replace(/[{}-]/g, ""); // remove extra characters
      const buffer = new Buffer(hex, "hex");
      return new mongodb_1.Binary(buffer, mongodb_1.Binary.SUBTYPE_UUID);
  }
docs: Based on: https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js