mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-26 18:51:50 +02:00
Merge pull request #22646 from overleaf/ar-address-mongo-count-deprecation-warning
[web] Switch from find.count to countDocuments GitOrigin-RevId: cc607868334d54b3d5c375c06fec97a482a16cc5
This commit is contained in:
@@ -15,12 +15,10 @@ function populateTeamInvites(user, callback) {
|
||||
async function countActiveUsers() {
|
||||
const oneYearAgo = new Date()
|
||||
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1)
|
||||
return await db.users
|
||||
.find(
|
||||
{ lastActive: { $gte: oneYearAgo } },
|
||||
{ readPreference: READ_PREFERENCE_SECONDARY }
|
||||
)
|
||||
.count()
|
||||
return await db.users.countDocuments(
|
||||
{ lastActive: { $gte: oneYearAgo } },
|
||||
{ readPreference: READ_PREFERENCE_SECONDARY }
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -17,9 +17,7 @@ describe('UserHandler', function () {
|
||||
|
||||
this.db = {
|
||||
users: {
|
||||
find: sinon.stub().returns({
|
||||
count: sinon.stub().resolves(2),
|
||||
}),
|
||||
countDocuments: sinon.stub().resolves(2),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user