[JAVA-1828] Filters.and methods should handle zero clauses correctly Created: 21/May/15 Updated: 28/May/15 Resolved: 28/May/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API, Query Operations |
| Affects Version/s: | 3.0.1 |
| Fix Version/s: | 3.0.2, 3.1.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Robert Stam | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The Filters builder 'and' and 'or' methods should handle empty lists of clauses by rendering them to $and and $or operators with empty arrays:
It is not really obvious what semantics And and Or should have when the list of clauses is empty. By rendering them this way we leave it up to the server to decide. The server currently returns error messages for both of these, but it might conceivably support them in the future. |
| Comments |
| Comment by Jeffrey Yemin [ 28/May/15 ] |
|
Released in 3.0.2. |
| Comment by Githook User [ 28/May/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Render Filters.and as {$and : [] } if the list of filters is empty. That way, the driver leaves it to the server to decide the meaning of an empty array for both $and and $or operators, which currently is to return an error. |
| Comment by Githook User [ 28/May/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Render Filters.and as {$and : [] } if the list of filters is empty. That way, the driver leaves it to the server to decide the meaning of an empty array for both $and and $or operators, which currently is to return an error. |