summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2018-12-09 18:39:13 +0900
committerAya Morisawa <AyaMorisawa4869@gmail.com>2018-12-09 18:39:13 +0900
commitcd80e02ebf5e7fa9fb7edc589d9149d60f2a77fa (patch)
treeec820d339a2f6d564d2c8f4f0ffeea3e035a5692
parentFix mobile following/followed list (#3574) (diff)
downloadsharkey-cd80e02ebf5e7fa9fb7edc589d9149d60f2a77fa.tar.gz
sharkey-cd80e02ebf5e7fa9fb7edc589d9149d60f2a77fa.tar.bz2
sharkey-cd80e02ebf5e7fa9fb7edc589d9149d60f2a77fa.zip
Re: #3556 (#3568)
* Update index.ts * Update index.ts
-rw-r--r--src/chart/index.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/chart/index.ts b/src/chart/index.ts
index b59ad7602b..913d49bec8 100644
--- a/src/chart/index.ts
+++ b/src/chart/index.ts
@@ -61,11 +61,13 @@ export default abstract class Chart<T> {
constructor(name: string, grouped = false) {
this.collection = db.get<Log<T>>(`chart.${name}`);
- if (grouped) {
- this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true });
- } else {
- this.collection.createIndex({ span: -1, date: -1 }, { unique: true });
- }
+ const keys = {
+ span: -1,
+ date: -1
+ };
+ if (grouped)
+ keys.group = -1;
+ this.collection.createIndex(keys, { unique: true });
}
@autobind