I changed the way that Spring Data Couchbase writes its _class attribute following this answer. Now, if I save an object of class com.package.entity.User, my document looks like:
{
    ...
    "_type": "user"
}
My point is, when I use query methods like public Long countByAdminIsTrue(), the request generated by Spring is the following: 
SELECT COUNT(*) FROM `myBucket` WHERE (`admin` = TRUE) AND `_type` = "com.package.entity.User"
Instead of the result I expect:
SELECT COUNT(*) FROM `myBucket` WHERE (`admin` = TRUE) AND `_type` = "user"
Here is my CouchbaseTypeMapper doint this work:
public class CustomCouchbaseTypeMapper extends DefaultTypeMapper<CouchbaseDocument> implements CouchbaseTypeMapper {
    public CustomCouchbaseTypeMapper() {
        super(new CustomCouchbaseDocumentTypeAliasAccessor());
    }
    @Override
    public String getTypeKey() {
        return "_type";
    }
    public static final class CustomCouchbaseDocumentTypeAliasAccessor implements TypeAliasAccessor<CouchbaseDocument> {
        @Override
        public Object readAliasFrom(CouchbaseDocument source) {
            return source.get("_type");
        }
        @Override
        public void writeTypeTo(CouchbaseDocument sink, Object alias) {
            String typeName = StringUtils.typeNameFromFullClassName((String) alias);
            sink.put("_type", typeName);
        }
    }
}
I already tried to define a ConfigurableTypeInformationMapper in the constructor with my entities, it doesn't help. 
How can I make Spring Data to use my custom type name and value when it generates a query based on a query method?
 
    