bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/clearUsersCollection.js

27 lines
841 B
JavaScript
Raw Normal View History

2016-05-17 02:05:44 +08:00
import Users from '/imports/api/users';
2016-05-13 01:43:59 +08:00
import { logger } from '/imports/startup/server/logger';
// called on server start and on meeting end
export function clearUsersCollection() {
const meetingId = arguments[0];
if (meetingId != null) {
return Users.remove({
meetingId: meetingId,
}, err => {
if (err != null) {
return logger.error(`_error ${JSON.stringify(err)} while removing users from ${meetingId}`);
} else {
return logger.info(`_cleared Users Collection (meetingId: ${meetingId})!`);
}
});
} else {
return Users.remove({}, err => {
if (err != null) {
return logger.error(`_error ${JSON.stringify(err)} while removing users from all meetings`);
} else {
return logger.info('_cleared Users Collection (all meetings)!');
}
});
}
};