mongo-java-server icon indicating copy to clipboard operation
mongo-java-server copied to clipboard

mongo-java-server's collation doesn't work

Open gregecho opened this issue 2 years ago • 1 comments

Hi there,

I'm using testImplementation group: 'de.bwaldvogel', name: 'mongo-java-server', version: '1.44.0' with Springboot 3.1.1. However, I found the lib didn't support collation feature well. Hence, below query with ignoreCase won't work:

    private final Collation collation = Collation.of("en").strength(Collation.ComparisonLevel.secondary());
public Credential findOneByUserNameIgnoreCase(String userName) {

        return mongoTemplate
            .findOne(new Query(Criteria.where(CredentialRepository.USER_NAME_FIELD).is(userName)).collation(collation),
                Credential.class);
    }

Any ideas? Thank in advance

gregecho avatar Aug 29 '23 01:08 gregecho

@bwaldvogel

gregecho avatar Aug 29 '23 01:08 gregecho