[CSHARP-1291] And and Or filter builder methods should handle zero clauses correctly Created: 21/May/15  Updated: 30/May/17  Resolved: 06/Jan/17

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 2.0
Fix Version/s: 2.4.2

Type: Improvement Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-1986 And with zero clauses renders as { $a... Closed
is related to CSHARP-1912 Filter builder.And(<emptyFilter>,<emp... Closed

 Description   

The Filter builder And and Or methods should handle empty lists of clauses by rendering them to $and and $or operators with empty arrays:

builder.And() => "{ $and : [ ] }"
builder.Or() => "{ $or : [ ] }"

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 Githook User [ 06/Jan/17 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1291: And and Or filter builder methods should handle zero clauses correctly.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/207c735df2d62dfe3e5deae4c467f4bd757a850d

Generated at Wed Feb 07 21:39:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.