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

Query criteria is not considered in the query [DATAMONGO-430] #1362

Closed
spring-projects-issues opened this issue Apr 10, 2012 · 3 comments
Closed
Assignees
Labels
in: core status: duplicate type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Apr 10, 2012

Khaled Ezzughayyar opened DATAMONGO-430 and commented

When I perform a query that includes more than one criteria, only the first criteria is being considered, others are discarded.

An example is attached; When the query is performed by MongoDB driver it works fine, but with Spring, the problem occurs


Attachments:

Issue Links:

  • DATAMONGO-369 Wrong query created when one value is a DBObject
    ("duplicates")
@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Apr 10, 2012

Oliver Drotbohm commented

What is the expected output? What do you get? I just tried parts of your code as follows:

Query query = new Query(where("keywords").in(Arrays.asList("foo"))
                         .and("loc").nearSphere(new Point(10.7, 10.7)).maxDistance(10.0 / 3959));
System.out.println(query.getQueryObject());

that prints:

{ "keywords" : { "$in" : [ "foo"]} , "loc" : { "$nearSphere" : [ 10.7 , 10.7] , "$maxDistance" : 0.002525890376357666}}

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Apr 10, 2012

Khaled Ezzughayyar commented

The problem is with QueryMapper. where it discards options.
I just debugged the problem and found it is resolved in 1.1.0

https://github.com/SpringSource/spring-data-mongodb/blob/master/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

It's resolved in line 101

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Apr 10, 2012

Oliver Drotbohm commented

That fix has been introduced for DATAMONGO-369 already which was released with 1.0.1.RELEASE. So can you please make sure you're using 1.0.1, not 1.0.0?

@spring-projects-issues spring-projects-issues added type: bug in: core status: duplicate labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: duplicate type: bug
Projects
None yet
Development

No branches or pull requests

2 participants