spring data mongodb how to explain query plan

16 Views Asked by At

I have a document

@Document("bank")
public class Bank {

    @Id
    private ObjectId id;

    private String accountName = "";

    private String accountType = "";

    private String accountNo = "";
}

I have a repository

public interface BankRepository extends MongoRepository<Bank, String> {
    @Query("{accountType:'?0'}")
    Bank findItemByAccountType(String accountType);
}

How do I log the query explain plan to the console?

I tried setting logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG

but it didn't print the explain plan

I want to see if it is using index or not.

0

There are 0 best solutions below