* Update index.ts

* Update index.ts
This commit is contained in:
Acid Chicken (硫酸鶏) 2018-12-09 18:39:13 +09:00 committed by Aya Morisawa
parent dffcefb81f
commit cd80e02ebf
1 changed files with 7 additions and 5 deletions

View File

@ -61,11 +61,13 @@ export default abstract class Chart<T> {
constructor(name: string, grouped = false) { constructor(name: string, grouped = false) {
this.collection = db.get<Log<T>>(`chart.${name}`); this.collection = db.get<Log<T>>(`chart.${name}`);
if (grouped) { const keys = {
this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true }); span: -1,
} else { date: -1
this.collection.createIndex({ span: -1, date: -1 }, { unique: true }); };
} if (grouped)
keys.group = -1;
this.collection.createIndex(keys, { unique: true });
} }
@autobind @autobind