Skip to content

Morphia and Indexes #2854

@vSKAH

Description

@vSKAH

Please ask your question and provide whatever background or supporting information you think might be relevant:

Hello I did this, however when I look in mongo compass the indexes do not appear. Do you have an idea?

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity(value = "player_battlepass")
@Indexes({
        @Index(fields = {@Field("player_id"), @Field("battlepass_id")}, options = @IndexOptions(unique = true, background = true, name = "player_battlepass_index")),
        @Index(fields = @Field("battlepass_id"), options = @IndexOptions(unique = true, background = true, name = "battlepass_id_index"))
})
public class PlayerBattlePass {

    @Id
    private int id;

    @Property("player_id")
    private UUID playerId;

    @Property("battlepass_id")
    private int battlePassId;
    
}

image

Server Version: MongoDB 5.0.24 Community
Driver Version: 4.11.0
Morphia Version: 2.4.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions