Skip to content

Commit

Permalink
Step 12.30: Add hook for removing unused messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Feb 13, 2017
1 parent 74bcd42 commit 8cd2d26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion imports/collections/chats.ts
@@ -1,4 +1,10 @@
import { MongoObservable } from 'meteor-rxjs';
import { Chat } from '../models';
import { Messages } from './messages';

export const Chats = new MongoObservable.Collection<Chat>('chats');
export const Chats = new MongoObservable.Collection<Chat>('chats');

// Dispose unused messages
Chats.collection.after.remove(function (userId, doc) {
Messages.collection.remove({ chatId: doc._id });
});

0 comments on commit 8cd2d26

Please sign in to comment.