Skip to content

Commit 90ce2e8

Browse files
author
Brian Chen
authored
Iterate through all elements of target array for FieldValue::ArrayRemove (#7288)
1 parent 05463c6 commit 90ce2e8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Firestore/core/src/model/transform_operation.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,12 @@ FieldValue ArrayTransform::Rep::Apply(
251251
}
252252
} else {
253253
HARD_ASSERT(type_ == Type::ArrayRemove);
254-
if (pos != result.end()) {
255-
result.erase(pos);
254+
for (size_t i = 0; i < result.size();) {
255+
if (element == result.at(i)) {
256+
result.erase(result.cbegin() + i);
257+
} else {
258+
++i;
259+
}
256260
}
257261
}
258262
}

0 commit comments

Comments
 (0)