The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/models/server/models/Statistics.js

28 lines
478 B

import { Base } from './_Base';
export class Statistics extends Base {
constructor() {
super('statistics');
this.tryEnsureIndex({ createdAt: -1 });
}
// FIND ONE
findOneById(_id, options) {
const query = { _id };
return this.findOne(query, options);
}
findLast() {
const options = {
sort: {
createdAt: -1,
},
limit: 1,
};
const records = this.find({}, options).fetch();
return records && records[0];
}
}
export default new Statistics();