// Изменение public static void updateApplicant(string id) { getCollections(); var filter = Builders <Applicant> .Filter.Eq("_id", new ObjectId(id)); var applicant = MongoHelper.applicant_collection.Find(filter).FirstOrDefault(); var update = Builders <Applicant> .Update .Set("history", Fabric.getListEvent(applicant)) .Set("age", 25) .Set("contacts.email", "*****@*****.**"); MongoHelper.applicant_collection.UpdateOne(filter, update); }
// Создание public static void createApplicant() { getCollections(); var age = 30; var applicant = new Applicant { name = "Павел Чехов", age = age, password = Fabric.faker.Internet.Password(), location = Fabric.getLocation(), contacts = Fabric.getContacts(), education = Fabric.getListEducation(DateTime.Now.AddYears(18 - age)), experience = Fabric.getListExperience(DateTime.Now.AddYears(18 - age)), specialization = Fabric.getListSpecialization(), views = Fabric.getViewsVacancy() }; MongoHelper.applicant_collection.InsertOne(applicant); }