mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
MongoDB 4.2 (#12331)
* use mongodb 4.2 in github actions * use .countDocuments in place of .count
This commit is contained in:
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -118,7 +118,7 @@ jobs:
|
|||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
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
|
- run: cp config.json.example config.json
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: |
|
run: |
|
||||||
@@ -141,7 +141,7 @@ jobs:
|
|||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
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
|
- run: cp config.json.example config.json
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: |
|
run: |
|
||||||
@@ -164,7 +164,7 @@ jobs:
|
|||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
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
|
- run: cp config.json.example config.json
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ async function fixGroupPlanMembers () {
|
|||||||
pause();
|
pause();
|
||||||
groupPlanCount += 1;
|
groupPlanCount += 1;
|
||||||
|
|
||||||
const canonicalMemberCount = await dbUsers.count(
|
const canonicalMemberCount = await dbUsers.countDocuments(
|
||||||
{
|
{
|
||||||
$or:
|
$or:
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ async function _deleteUnfinishedTasks (groupMemberTask) {
|
|||||||
async function _evaluateAllAssignedCompletion (masterTask) {
|
async function _evaluateAllAssignedCompletion (masterTask) {
|
||||||
let completions;
|
let completions;
|
||||||
if (masterTask.group.approval && masterTask.group.approval.required) {
|
if (masterTask.group.approval && masterTask.group.approval.required) {
|
||||||
completions = await Tasks.Task.count({
|
completions = await Tasks.Task.countDocuments({
|
||||||
'group.taskId': masterTask._id,
|
'group.taskId': masterTask._id,
|
||||||
'group.approval.approved': true,
|
'group.approval.approved': true,
|
||||||
}).exec();
|
}).exec();
|
||||||
completions += 1;
|
completions += 1;
|
||||||
} else {
|
} else {
|
||||||
completions = await Tasks.Task.count({
|
completions = await Tasks.Task.countDocuments({
|
||||||
'group.taskId': masterTask._id,
|
'group.taskId': masterTask._id,
|
||||||
completed: true,
|
completed: true,
|
||||||
}).exec();
|
}).exec();
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ schema.statics.validateInvitations = async function getInvitationErr (invites, r
|
|||||||
const query = {};
|
const query = {};
|
||||||
query['invitations.party.id'] = group._id;
|
query['invitations.party.id'] = group._id;
|
||||||
// @TODO invitations are now stored like this: `'invitations.parties': []`
|
// @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;
|
memberCount += groupInvites;
|
||||||
|
|
||||||
// Counting the members that are going to be invited by email and uuids
|
// 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 };
|
query = { 'party._id': this._id };
|
||||||
}
|
}
|
||||||
|
|
||||||
return User.count(query).exec();
|
return User.countDocuments(query).exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
schema.methods.sendChat = function sendChat (options = {}) {
|
schema.methods.sendChat = function sendChat (options = {}) {
|
||||||
@@ -1743,7 +1743,7 @@ export const model = mongoose.model('Group', schema);
|
|||||||
// initialize tavern if !exists (fresh installs)
|
// 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
|
// do not run when testing as it's handled by the tests and can easily cause a race condition
|
||||||
if (!nconf.get('IS_TEST')) {
|
if (!nconf.get('IS_TEST')) {
|
||||||
model.count({ _id: TAVERN_ID }, (err, ct) => {
|
model.countDocuments({ _id: TAVERN_ID }, (err, ct) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
if (ct > 0) return;
|
if (ct > 0) return;
|
||||||
new model({ // eslint-disable-line new-cap
|
new model({ // eslint-disable-line new-cap
|
||||||
|
|||||||
Reference in New Issue
Block a user