Hi. I use Spring Boot with mongodb-starter(v.2.2.0). It seems that sorting doesn't work in some cases. I have entity:

public class SipTechComponent {

@Field("id")
@Id
protected String componentId;

protected String serviceId;

I was trying to get documents sorted by componentId field(direction=ASC):

pr = PageRequest.of(page, size, direction, orderBy); 
repository.findAll(request);

And I got exception, kind of:

Bad sort specification

But, sorting by serviceId field works properly.

I analyzed mongod logs and I figured out that in case of serviceId command's fragment for sorting is:

sort: { serviceId: 1 }

but in case of componentId:

sort: { _id: "1" }

I think value must be number anyway. Am I right, or it's my bad and something wrong with my code?

Comment From: wilkinsona

Spring Data MongoDB is managed as a separate project. If you have a question about it, Stack Overflow or Gitter are the best places to ask. If you believe you have found a bug, they use JIRA.