You can create another class for id and userId. Adding that class as an object in your Asset class and put an annotation @id for that object.
id
userId
Asset
@id
Reff: https://www.baeldung.com/spring-data-mongodb-composite-key