aboutsummaryrefslogtreecommitdiff
path: root/src/fields/List.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-10-15 22:26:16 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-10-15 22:26:16 +0530
commit3b81903962ac10bbf87013e045c7fdf101fea9ec (patch)
treedcee81b1fb07c18966272c32975da3899e512228 /src/fields/List.ts
parentae57452f05cca70a498e826fb3320bd2182ba88b (diff)
parent377d5c987728c2678ab38565328f1f7ad9f3d135 (diff)
merging
Diffstat (limited to 'src/fields/List.ts')
-rw-r--r--src/fields/List.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fields/List.ts b/src/fields/List.ts
index ceb538b2d..a0cbebaf5 100644
--- a/src/fields/List.ts
+++ b/src/fields/List.ts
@@ -43,7 +43,7 @@ const listHandlers: any = {
}
}
const res = list.__fields.push(...items);
- this[Update]({ op: "$addToSet", items });
+ this[Update]({ op: "$addToSet", items, length: length + items.length });
return res;
}),
reverse() {
@@ -77,7 +77,8 @@ const listHandlers: any = {
}
}
const res = list.__fields.splice(start, deleteCount, ...items);
- this[Update](items.length === 0 && deleteCount ? { op: "$remFromSet", items: removed } : undefined);
+ this[Update](items.length === 0 && deleteCount ? { op: "$remFromSet", items: removed, length: list.__fields.length } :
+ items.length && !deleteCount ? { op: "$addToSet", items, length: list.__fields.length } : undefined);
return res.map(toRealField);
}),
unshift(...items: any[]) {