[CSHARP-814] String IsNullOrEmpty does not test for fields ignored if null Created: 05/Sep/13 Updated: 16/Jul/15 Resolved: 22/Apr/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 1.7.1 |
| Fix Version/s: | 2.0.1, 2.1 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Andy Clapham | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Rewrite Linq |
| Description |
|
String.IsNullOrEmpty(x.S) expands to }, { "S" : "" }] If a field has BsonIgnoreIfNull, it should also test { "S" : null }Here's a test illustrating this:
|
| Comments |
| Comment by Githook User [ 22/Apr/15 ] |
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: |
| Comment by Andy Clapham [ 05/Sep/13 ] |
|
Yes we're doing just that, however it would be nice to have this built in. |
| Comment by Craig Wilson [ 05/Sep/13 ] |
|
It does appear that we have enough information to do this. There seems to be a simple workaround for now, simply use (s == null || s == string.Empty). |