Regression: Get room's members list not working on MongoDB 3.2 (#13051)

* Revert status filter for members list

* Get MongoDB version on statistics
pull/13052/head
Diego Sampaio 7 years ago committed by Rodrigo Nascimento
parent d9765a79ad
commit ba1f1b49de
No known key found for this signature in database
GPG Key ID: CFCE33B7B01AC335
  1. 11
      packages/rocketchat-statistics/server/functions/get.js
  2. 10
      server/methods/getUsersOfRoom.js

@ -105,9 +105,18 @@ RocketChat.statistics.get = function _getStatistics() {
statistics.migration = RocketChat.Migrations._getControl();
statistics.instanceCount = InstanceStatus.getCollection().find({ _updatedAt: { $gt: new Date(Date.now() - process.uptime() * 1000 - 2000) } }).count();
if (MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle && MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle.onOplogEntry && RocketChat.settings.get('Force_Disable_OpLog_For_Cache') !== true) {
const { mongo } = MongoInternals.defaultRemoteCollectionDriver();
if (mongo._oplogHandle && mongo._oplogHandle.onOplogEntry && RocketChat.settings.get('Force_Disable_OpLog_For_Cache') !== true) {
statistics.oplogEnabled = true;
}
try {
const { version } = Promise.await(mongo.db.command({ buildInfo: 1 }));
statistics.mongoVersion = version;
} catch (e) {
console.error('Error getting MongoDB version');
}
return statistics;
};

@ -39,8 +39,14 @@ Meteor.methods({
'u.status': 1,
},
},
...(showAll ? [] : [{ $match: { 'u.status': 'online' } }]),
{ $replaceRoot: { newRoot: { $arrayElemAt: ['$u', 0] } } },
...(showAll ? [] : [{ $match: { 'u.status': { $in: ['online', 'away', 'busy'] } } }]),
{
$project: {
_id: { $arrayElemAt: ['$u._id', 0] },
name: { $arrayElemAt: ['$u.name', 0] },
username: { $arrayElemAt: ['$u.username', 0] },
},
},
]).toArray(),
};
},

Loading…
Cancel
Save