Compound Indexing with id and another field of data class where id is also a field in my data class

Hello, hope you are doing fine.

I am using CompundIndex annotation on my data class where data calss have fields such as id, roomId and more . And my purpose is to use both id and roomId as compund index but unfortunately I am not able to do so and it is considering only id as index, can you please help me with that ?

@Document
@CompoundIndexes(value = [CompoundIndex(name = "operationId", def = "{'_id': 1, 'roomId': 1}", unique = true, sparse = true)])
data class Floor(
        override var id: ObjectId?,
        var roomId: ObjectId?,
        override val expiredAt: OffsetDateTime,
        val error: String? = null,
) : MongoExpiry

and let me know if more information is needed
Thanks,
Mukul