| 933 | REGISTER_UPDATE_OPERATOR(ExtUpdateOperatorAddToSet, "$addToSet"); |
| 934 | |
| 935 | struct ExtUpdateOperatorCurrentDate { |
| 936 | static const char* name; |
| 937 | static Future<Void> execute(Reference<IReadWriteContext> cx, |
| 938 | StringRef const& path, |
| 939 | bson::BSONElement const& element) { |
| 940 | if (element.isBoolean() && element.Bool()) { |
| 941 | DataValue dv = DataValue(bson::Date_t(timer() * 1000)); |
| 942 | cx->getSubContext(path)->clearDescendants(); |
| 943 | cx->set(path, dv.encode_value()); |
| 944 | } else if (element.isABSONObj() && element.Obj().hasField("$type")) { |
| 945 | auto typeField = element.Obj().getField("$type"); |
| 946 | if (typeField.isString() && typeField.String() == "date") { |
| 947 | DataValue dv = DataValue(bson::Date_t(timer() * 1000)); |
| 948 | cx->getSubContext(path)->clearDescendants(); |
| 949 | cx->set(path, dv.encode_value()); |
| 950 | } else if (typeField.isString() && typeField.String() == "timestamp") { |
| 951 | throw no_mongo_timestamps(); |
| 952 | } |
| 953 | } |
| 954 | return Void(); |
| 955 | } |
| 956 | }; |
| 957 | REGISTER_UPDATE_OPERATOR(ExtUpdateOperatorCurrentDate, "$currentDate"); |
| 958 | |
| 959 | ACTOR static Future<Void> getAndCompare(Reference<IReadWriteContext> cx, |
nothing calls this directly
no outgoing calls
no test coverage detected