2017-10-12 08:52:57 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
|
2021-10-20 04:35:39 +08:00
|
|
|
const collectionOptions = Meteor.isClient ? {
|
|
|
|
connection: null,
|
|
|
|
} : {};
|
|
|
|
|
|
|
|
const Annotations = new Mongo.Collection('annotations', collectionOptions);
|
2017-10-12 08:52:57 +08:00
|
|
|
|
|
|
|
if (Meteor.isServer) {
|
2018-04-11 07:27:11 +08:00
|
|
|
// types of queries for the annotations (Total):
|
|
|
|
// 1. meetingId, id, userId ( 8 )
|
|
|
|
// 2. meetingId, id, userId, whiteboardId ( 1 )
|
|
|
|
// 3. meetingId ( 1 )
|
|
|
|
// 4. meetingId, whiteboardId ( 1 )
|
|
|
|
// 5. meetingId, whiteboardId, id ( 1 )
|
|
|
|
// 6. meetingId, whiteboardId, userId ( 1 )
|
2017-10-12 08:52:57 +08:00
|
|
|
// These 2 indexes seem to cover all of the cases
|
|
|
|
|
2023-03-15 01:27:52 +08:00
|
|
|
Annotations.createIndexAsync({ id: 1 });
|
|
|
|
Annotations.createIndexAsync({ meetingId: 1, whiteboardId: 1, userId: 1 });
|
2017-10-12 08:52:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Annotations;
|