Hello
I am facing a problem with VS, whenever I try to update my fields I face the next issue:
"MongoDB.Bson.BsonSerializationException: ‘The property ‘Padding’ of type ‘System.Windows.Forms.TextBoxBase’ cannot use element name ‘Padding’ because it is already being used by property ‘Padding’ of type ‘System.Windows.Forms.Control’.’
This my Class Student:
class Student
{
[BsonId]
public ObjectId Id { get; set; }
[BsonElement(“name”)]
public String Name { get; set; }
[BsonElement(“gender”)]
public String Gender { get; set; }
[BsonElement(“age”)]
public int Age { get; set; }
public Student(string name, string gender, int age)
{
Name = name;
Gender = gender;
Age = age;
}
and this is my Update method
{
var updateFiled = Builders.Update.Set(“name”, textBox2).Set(“gender”, textBox3).Set(“age”, textBox4);
collection.UpdateOne(s => s.Id == ObjectId.Parse(textBox1.Text), updateFiled);
ReadAllDocuments();
}
I look forward to hear from you
Thanks