Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoTemplate Find Method Ignores Query Sort Information [DATAMONGO-478] #1415

Closed
spring-projects-issues opened this issue Jul 6, 2012 · 1 comment
Assignees
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Jul 6, 2012

Mark Aden opened DATAMONGO-478 and commented

I am trying to perform a find operation using mongoTemplate.find(…) method and it seems that sort information is ignored by spring-data-mongo. It looks like the sort information is simply not passed to the MongoDB when using the find(…) method but it is however when using findAndModify(…) method.

My code looks something like this and I am wondering if there is a bug in spring-data-mongo or if I'm doing it all wrong?

Query query = new Query(Criteria.where("status").is("completed")).limit(limit);
query.sort().on("completedOn", Order.DESCENDING);
//note that the result is not sorted.
List<Status> result = mongoTemplate.find(query, Status.class)

Affects: 1.0.2, 1.1 M1

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 16, 2012

Oliver Drotbohm commented

Is there a chance you provide a test case to reproduce the issue? If you debug the code, not that the sorting is applied through the QueryCursorPreparer in MongoTemplate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

2 participants