Update mongoose count usages to countDocuments

count was removed see:
https://mongoosejs.com/docs/migrating_to_8.html#removed-count.

GitOrigin-RevId: 308c8f4b681269c29669c45b5f2022404b3af463
This commit is contained in:
andrew rumble 2024-08-16 10:53:10 +01:00 committed by Copybot
parent 5f699ac5ef
commit 0c428e149f
2 changed files with 5 additions and 3 deletions

View file

@ -8,7 +8,7 @@ async function getAllTags(userId) {
}
async function countTagsForProject(userId, projectId) {
return Tag.count({ user_id: userId, project_ids: projectId })
return Tag.countDocuments({ user_id: userId, project_ids: projectId })
}
async function getTagsForProject(userId, projectId) {

View file

@ -16,8 +16,10 @@ async function main() {
console.log('## Syncing group subscription memberships...')
const subscriptionsCount = await Subscription.count({ groupPlan: true })
const deletedSubscriptionsCount = await DeletedSubscription.count({
const subscriptionsCount = await Subscription.countDocuments({
groupPlan: true,
})
const deletedSubscriptionsCount = await DeletedSubscription.countDocuments({
'subscription.groupPlan': true,
})