mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 06:53:08 +02:00
Fix drop index
This commit is contained in:
parent
7860d97a10
commit
52aa64fcb6
1 changed files with 6 additions and 1 deletions
|
@ -2,7 +2,12 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
|
||||||
const Stats = db.get<IStats>('stats');
|
const Stats = db.get<IStats>('stats');
|
||||||
Stats.dropIndex({ date: -1 } as any); // 後方互換性のため
|
|
||||||
|
// 後方互換性のため
|
||||||
|
Stats.dropIndex({ date: -1 } as any).catch((e: mongo.MongoError) => {
|
||||||
|
if (e.code !== 27) throw e;
|
||||||
|
});
|
||||||
|
|
||||||
Stats.createIndex({ span: -1, date: -1 }, { unique: true });
|
Stats.createIndex({ span: -1, date: -1 }, { unique: true });
|
||||||
export default Stats;
|
export default Stats;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue