MongoDB 4.2 (#12331)

* use mongodb 4.2 in github actions

* use .countDocuments in place of .count
This commit is contained in:
Matteo Pagliazzi
2020-06-25 16:50:57 +02:00
committed by GitHub
parent 6058b3d4b4
commit a44aef3d9f
4 changed files with 9 additions and 9 deletions

View File

@@ -482,7 +482,7 @@ schema.statics.validateInvitations = async function getInvitationErr (invites, r
const query = {};
query['invitations.party.id'] = group._id;
// @TODO invitations are now stored like this: `'invitations.parties': []`
const groupInvites = await User.count(query).exec();
const groupInvites = await User.countDocuments(query).exec();
memberCount += groupInvites;
// Counting the members that are going to be invited by email and uuids
@@ -537,7 +537,7 @@ schema.methods.getMemberCount = async function getMemberCount () {
query = { 'party._id': this._id };
}
return User.count(query).exec();
return User.countDocuments(query).exec();
};
schema.methods.sendChat = function sendChat (options = {}) {
@@ -1743,7 +1743,7 @@ export const model = mongoose.model('Group', schema);
// initialize tavern if !exists (fresh installs)
// do not run when testing as it's handled by the tests and can easily cause a race condition
if (!nconf.get('IS_TEST')) {
model.count({ _id: TAVERN_ID }, (err, ct) => {
model.countDocuments({ _id: TAVERN_ID }, (err, ct) => {
if (err) throw err;
if (ct > 0) return;
new model({ // eslint-disable-line new-cap