| 944 | } |
| 945 | |
| 946 | void staticValidateModifiedFields(std::string fieldName, |
| 947 | std::set<std::string>* affectedFields, |
| 948 | std::set<std::string>* prefixesOfAffectedFields) { |
| 949 | if (affectedFields->find(fieldName) != affectedFields->end()) |
| 950 | throw field_name_duplication_with_mods(); |
| 951 | if (prefixesOfAffectedFields->find(fieldName) != prefixesOfAffectedFields->end()) |
| 952 | throw conflicting_mods_in_update(); |
| 953 | affectedFields->insert(fieldName); |
| 954 | auto upOneFn = upOneLevel(fieldName); |
| 955 | if (!upOneFn.empty()) { |
| 956 | while (!upOneFn.empty()) { |
| 957 | if (affectedFields->find(upOneFn) != affectedFields->end()) |
| 958 | throw conflicting_mods_in_update(); |
| 959 | prefixesOfAffectedFields->insert(upOneFn); |
| 960 | upOneFn = upOneLevel(upOneFn); |
| 961 | } |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | std::vector<std::string> staticValidateUpdateObject(bson::BSONObj update, bool multi, bool upsert) { |
| 966 | std::set<std::string> affectedFields; |
no test coverage detected