mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-27 06:44:08 +00: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:
parent
784d107472
commit
ccb2791a0d
2 changed files with 5 additions and 9 deletions
|
@ -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),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue