Announcement Announcement Module
Collapse
No announcement yet.
Query ignores .gt .lt when same attribute is specified twice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Query ignores .gt .lt when same attribute is specified twice

    Hi.

    I'm using Mongo M3 (since M4 has a showstopper for me) and encountered the following bug:

    I create a query with the Criteria object using .and and .gt/.lt. I have a query where a Date will be queried
    within a range specifying .lt AND .gt on the same attribute recognizedOn. I would expected that the generated mongo query contains
    both restrictions. Instead it only contains the last specified constraint (lt). Code snippet:

    Code:
    		// this gets lost
    		if (recognizedOnGt != null) {
    			criteria = criteria.and(ATTR_RECOGNIZED).gt(recognizedOnGt);
    		}
    		// that wins
    		if (recognizedOnLt != null) {
    			criteria = criteria.and(ATTR_RECOGNIZED).lt(recognizedOnLt);
    		}
    Is that a known bug? I took a look at the issues in M3 and couldn't find any.

    If I swap the two if clauses, gt "wins".

    Thanks
    Veit

  • #2
    I'm not a developer for springsource but i took a look at the source code. This is a bug. I Opened a JIRA ticket.

    https://jira.springsource.org/browse/DATADOC-299

    Comment


    • #3
      Originally posted by imbz View Post
      I'm not a developer for springsource but i took a look at the source code. This is a bug. I Opened a JIRA ticket.

      https://jira.springsource.org/browse/DATADOC-299
      Thanks for your time!

      Comment

      Working...
      X