Permalink
Browse files

Step 13.33: Add hook for removing unused messages

  • Loading branch information...
dotansimha authored and darkbasic committed Jan 24, 2017
1 parent 6ee435f commit 9ee38563a44a2ee3d9d6d4d846ec10fa772c4295
Showing with 6 additions and 0 deletions.
  1. +6 −0 api/server/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');
// Dispose unused messages
Chats.collection.after.remove(function (userId, doc) {
Messages.collection.remove({ chatId: doc._id });
});

0 comments on commit 9ee3856

Please sign in to comment.