Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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

You must be logged in to vote

Replies: 1 comment · 5 replies

Comment options

did you call datastore.ensureIndexes() ?

You must be logged in to vote
5 replies
@vSKAH
Comment options

No, sorry i don't use because in 2.4.11 the fonction deprecated :/

@vSKAH
Comment options

Don't you have another way of doing it?

@evanchooly
Comment options

It's done automatically in most cases with 2.4.11 and the new config system but you can call it directly if you'd like. That method just doesn't exist in 3.0 anymore.

@oewang
Comment options

@evanchooly I have the same problem, but I call the datastore.ensureIndexes() method and the indexes are not generated.

MongoDB Server Version: 4.0.23
Driver Version: 3.4.2
Morphia Version: 1.3.2

@evanchooly
Comment options

I would recommend upgrading to 1.6 at a minimum 2.4 if possible. 1.3.2 is rather ancient and has been working for a decade or so. Double check that you're looking in the correct database, etc., for your indexes. Check the logs for any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants
Converted from issue

This discussion was converted from issue #2854 on February 16, 2024 18:46.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.