[CSHARP-1857] FindOneAndReplace or ReplaceOne is not working sometime Created: 02/Dec/16 Updated: 27/Oct/23 Resolved: 05/Dec/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Operations |
| Affects Version/s: | 2.2.4, 2.4 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Kalpesh Chheda [X] | Assignee: | Robert Stam |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | Bug, question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows Server 2016, Asp.net, |
||
| Description |
Below is the debug output. My document is not getting replaced. Check SuccessfullConnect variable it is still false. I checked on server also document is not replaced. And sometime its working and sometime its not working.
|
| Comments |
| Comment by Robert Stam [ 05/Dec/16 ] |
|
FindOneAndReplace by default returns the original version of the replaced document. The document should be changed in your database, but your local variable up contains a copy of the document as it was before the replacement. If you want FindOneAndReplace to return the modified document use the options parameter and set the ReturnDocument property to ReturnDocument.After. |
| Comment by Kalpesh Chheda [X] [ 02/Dec/16 ] |
|
For reading formatted code. Similar issue by other |