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

@@ -118,7 +118,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- run: cp config.json.example config.json
- name: npm install
run: |
@@ -141,7 +141,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- run: cp config.json.example config.json
- name: npm install
run: |
@@ -164,7 +164,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- run: cp config.json.example config.json
- name: npm install
run: |

View File

@@ -45,7 +45,7 @@ async function fixGroupPlanMembers () {
pause();
groupPlanCount += 1;
const canonicalMemberCount = await dbUsers.count(
const canonicalMemberCount = await dbUsers.countDocuments(
{
$or:
[

View File

@@ -24,13 +24,13 @@ async function _deleteUnfinishedTasks (groupMemberTask) {
async function _evaluateAllAssignedCompletion (masterTask) {
let completions;
if (masterTask.group.approval && masterTask.group.approval.required) {
completions = await Tasks.Task.count({
completions = await Tasks.Task.countDocuments({
'group.taskId': masterTask._id,
'group.approval.approved': true,
}).exec();
completions += 1;
} else {
completions = await Tasks.Task.count({
completions = await Tasks.Task.countDocuments({
'group.taskId': masterTask._id,
completed: true,
}).exec();

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