[CSHARP-4471] UpdateOneAsync with comment cause MongoCommandException Created: 03/Jan/23  Updated: 27/Oct/23  Resolved: 04/Jan/23

Status: Closed
Project: C# Driver
Component/s: CRUD
Affects Version/s: 2.18.0
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: p3 p3 Assignee: Dmitry Lukyanov (Inactive)
Resolution: Works as Designed Votes: 0
Labels: Bug
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-4472 UpdateOneAsync with comment cause Mon... Closed

 Description   

Summary

await coll.UpdateOneAsync(p => p.Name == "username", update, new UpdateOptions() { Comment = "abc"  });

MongoDB.Driver.MongoCommandException : Command update failed: BSON field 'update.comment' is an unknown field..

Environment

MongoDB.Driver 2.18.0

Dotnet 6

Windows 11 x64

Mongodb Server version 4.2



 Comments   
Comment by p3 p3 [ 04/Jan/23 ]

Thanks for your reply, I upgraded to MongoDB version 4.4 and it solved my problem.

Comment by Dmitry Lukyanov (Inactive) [ 03/Jan/23 ]

Hey gw2008@gmail.com . This is expected behavior since server supports $comment for update operation starting from version 4.4. You can see it here (search for UpdateOptions and see an xml comment for "comment: Optional<any>")

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