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/packages/rocketchat-statistics/server/models/Statistics.js

24 lines
447 B

RocketChat.models.Statistics = new class extends RocketChat.models._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];
}
};