[CSHARP-281] PopFirst and PopLast do the opposite jobs Created: 25/Jul/11 Updated: 02/Apr/15 Resolved: 26/Jul/11 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.1 |
| Fix Version/s: | 1.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Roman Kuzmin | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Major Change |
| Description |
|
Here is the PowerShell script that shows the bug: Add-Type -Path MongoDB.Driver.dll
Note: I have also tried some real example but the code is not so easy to share. Yes, these function do the opposite job, as if their bodies are swapped by mistake. |
| Comments |
| Comment by Robert Stam [ 26/Jul/11 ] |
|
The implementations PopFirst and PopLast were reversed. If you compensated for this by using the opposite method then this fix will break your code. |
| Comment by Robert Stam [ 26/Jul/11 ] |
|
If you ever need to write code that does different things depending on which version of the driver it is using, you can discover the version of the driver at runtime using: var assembly = typeof(MongoServer).Assembly; In this particular case, if you want your code to work before and after this fix you could avoid using Update.PopFirst and Update.PopLast and just build the update modifier directly: var update = new UpdateDocument("$pop", new BsonDocument("x", -1)); // instead of PopFirst |
| Comment by Roman Kuzmin [ 25/Jul/11 ] |
|
Yes, the fix will break the workaround. It will be more difficult to watch both official 1.1 and the latest version built from sources. |
| Comment by Robert Stam [ 25/Jul/11 ] |
|
This is going to be a backward breaking fix. If you compensated for this bug by calling the opposite function you will be affected when they start doing what they are supposed to be doing. |
| Comment by Robert Stam [ 25/Jul/11 ] |
|
That's definitely a mistake. Thanks for reporting this. |