This commit is contained in:
syuilo
2018-04-17 19:55:58 +09:00
parent e69554f810
commit 0f67a544bd
2 changed files with 33 additions and 6 deletions

View File

@ -8,11 +8,11 @@ import MessagingMessage, { deleteMessagingMessage } from './messaging-message';
import User from './user';
const DriveFile = monkDb.get<IDriveFile>('driveFiles.files');
DriveFile.createIndex('metadata.uri', { sparse: true, unique: true });
export default DriveFile;
export const DriveFileChunk = monkDb.get('driveFiles.chunks');
const getGridFSBucket = async (): Promise<mongo.GridFSBucket> => {
const db = await nativeDbConn();
const bucket = new mongo.GridFSBucket(db, {
@ -93,7 +93,7 @@ export async function deleteDriveFile(driveFile: string | mongo.ObjectID | IDriv
}
// このDriveFileのチャンクをすべて削除
await monkDb.get('driveFiles.chunks').remove({
await DriveFileChunk.remove({
files_id: d._id
});