Schema validation failed - Atlas Device Sync

I want to use the Atlas device sync feature of Mongo DB in my Application. I have modeled a BankAccount class in my Kotlin code like this.

open class BankAccount: RealmObject, Searchable {

    @PrimaryKey
    var _id: ObjectId = ObjectId()

    var accountHolderName: String = ""

    var accountNumber: String = ""

    var accountType: String = ""

    var bankName: String = ""

    var cardCvv: String = ""

    var cardNo: String = ""

    var cardPin: String = ""

    var expiryDate: String = ""

    var haveBankingApp: Boolean = false

    var haveCard: Boolean = false

    var haveUpi: Boolean = false

    var ifscCode: String = ""

    var isArchived: Int = 0

    var loginPin: String = ""

    var nameOnCard: String = ""

    var ownerId: String = ""

    var regEmail: String = ""

    var regMobNo: String = ""

    var remarks: String = ""

    var transactionPin: String = ""

    var upiPin: String = ""

    override fun doesMatchSearchQuery(query: String): Boolean {
        return bankName.contains(query.trim(), ignoreCase = true) || accountHolderName.contains(query.trim(), ignoreCase = true)
    }
}

My JSON Schema looks like this:

{
  "title": "BankAccount",
  "properties": {
    "_id": {
      "bsonType": "objectId"
    },
    "ownerId": {
      "bsonType": "string"
    },
    "bankName": {
      "bsonType": "string"
    },
    "accountHolderName": {
      "bsonType": "string"
    },
    "accountType": {
      "bsonType": "string"
    },
    "accountNumber": {
      "bsonType": "string"
    },
    "ifscCode": {
      "bsonType": "string"
    },
    "regMobNo": {
      "bsonType": "string"
    },
    "regEmail": {
      "bsonType": "string"
    },
    "remarks": {
      "bsonType": "string"
    },
    "haveCard": {
      "bsonType": "bool"
    },
    "nameOnCard": {
      "bsonType": "string"
    },
    "cardNo": {
      "bsonType": "string"
    },
    "expiryDate": {
      "bsonType": "string"
    },
    "cardCvv": {
      "bsonType": "string"
    },
    "cardPin": {
      "bsonType": "string"
    },
    "haveUpi": {
      "bsonType": "bool"
    },
    "upiPin": {
      "bsonType": "string"
    },
    "haveBankingApp": {
      "bsonType": "bool"
    },
    "loginPin": {
      "bsonType": "string"
    },
    "transactionPin": {
      "bsonType": "string"
    },
    "isArchived": {
      "bsonType": "int"
    }
  },
  "required": [
    "_id",
    "ownerId",
    "bankName",
    "accountHolderName",
    "accountType",
    "accountNumber",
    "ifscCode",
    "regMobNo",
    "regEmail",
    "remarks",
    "haveCard",
    "nameOnCard",
    "cardNo",
    "expiryDate",
    "cardCvv",
    "cardPin",
    "haveUpi",
    "upiPin",
    "haveBankingApp",
    "loginPin",
    "transactionPin",
    "isArchived"
  ]
}

Everything is perfect. I have enabled device sync correctly set the permissions in the right way and also configured the Mongo DB realm perfectly, but I am still constantly getting this error of the primary key :frowning: