Fixed _ensureIndex to createIndex for MongoDB 5. Updated to latest Meteor beta.

This commit is contained in:
Lauri Ojansivu 2021-10-09 15:56:16 +03:00 committed by Denis Perov
parent 4bbe63365c
commit c926475eb1
29 changed files with 68 additions and 63 deletions

View file

@ -6,9 +6,9 @@
meteor-base@1.5.1
# Build system
ecmascript@0.15.3
ecmascript@0.16.0-beta250.3
standard-minifier-css@1.7.4
standard-minifier-js@2.7.0
standard-minifier-js@2.7.1
mquandalle:jade
coffeescript@2.4.1!
@ -122,7 +122,7 @@ pascoual:pdfkit
lmieulet:meteor-coverage
meteortesting:mocha
aldeed:simple-schema
accounts-password
accounts-password@2.2.0-beta250.3
matb33:collection-hooks
simple:json-routes
kadira:flow-router

View file

@ -1 +1 @@
METEOR@2.4
METEOR@2.5-beta.3

View file

@ -1,5 +1,5 @@
accounts-base@2.1.0
accounts-password@2.1.0
accounts-base@2.2.0-beta250.3
accounts-password@2.2.0-beta250.3
aldeed:collection2@2.10.0
aldeed:collection2-core@1.2.0
aldeed:schema-deny@1.1.0
@ -8,7 +8,7 @@ aldeed:simple-schema@1.5.4
allow-deny@1.1.0
arillo:flow-router-helpers@0.5.2
audit-argument-checks@1.0.7
autoupdate@1.7.0
autoupdate@1.8.0-beta250.3
babel-compiler@7.7.0
babel-runtime@1.5.0
base64@1.0.12
@ -38,7 +38,7 @@ deps@1.0.12
diff-sequence@1.1.1
dynamic-import@0.7.1
easylogic:summernote@0.8.8
ecmascript@0.15.3
ecmascript@0.16.0-beta250.3
ecmascript-runtime@0.8.0
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
@ -171,14 +171,14 @@ rajit:bootstrap3-datepicker-zh-cn@1.7.1
rajit:bootstrap3-datepicker-zh-tw@1.7.1
random@1.2.0
rate-limit@1.0.9
react-fast-refresh@0.1.1
react-fast-refresh@0.2.0-beta250.3
reactive-dict@1.3.0
reactive-var@1.0.11
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
rzymek:fullcalendar@3.8.0
service-configuration@1.2.0
service-configuration@1.3.0-beta250.3
session@1.2.0
sha@1.0.9
shell-server@0.5.0
@ -201,7 +201,7 @@ url@1.3.2
useraccounts:core@1.16.2
useraccounts:flow-routing@1.15.0
useraccounts:unstyled@1.14.2
webapp@1.13.0
webapp@1.13.0-beta250.3
webapp-hashing@1.1.0
wekan-markdown@1.0.9
zimme:active-route@2.3.2

View file

@ -51,7 +51,7 @@ AccountSettings.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
AccountSettings._collection._ensureIndex({ modifiedAt: -1 });
AccountSettings._collection.createIndex({ modifiedAt: -1 });
AccountSettings.upsert(
{ _id: 'accounts-allowEmailChange' },
{

View file

@ -32,7 +32,7 @@ Actions.helpers({
if (Meteor.isServer) {
Meteor.startup(() => {
Actions._collection._ensureIndex({ modifiedAt: -1 });
Actions._collection.createIndex({ modifiedAt: -1 });
});
}

View file

@ -82,19 +82,19 @@ if (Meteor.isServer) {
// creation in conjunction with the card or board id, as corresponding views
// are largely used in the App. See #524.
Meteor.startup(() => {
Activities._collection._ensureIndex({ createdAt: -1 });
Activities._collection._ensureIndex({ modifiedAt: -1 });
Activities._collection._ensureIndex({ cardId: 1, createdAt: -1 });
Activities._collection._ensureIndex({ boardId: 1, createdAt: -1 });
Activities._collection._ensureIndex(
Activities._collection.createIndex({ createdAt: -1 });
Activities._collection.createIndex({ modifiedAt: -1 });
Activities._collection.createIndex({ cardId: 1, createdAt: -1 });
Activities._collection.createIndex({ boardId: 1, createdAt: -1 });
Activities._collection.createIndex(
{ commentId: 1 },
{ partialFilterExpression: { commentId: { $exists: true } } },
);
Activities._collection._ensureIndex(
Activities._collection.createIndex(
{ attachmentId: 1 },
{ partialFilterExpression: { attachmentId: { $exists: true } } },
);
Activities._collection._ensureIndex(
Activities._collection.createIndex(
{ customFieldId: 1 },
{ partialFilterExpression: { customFieldId: { $exists: true } } },
);

View file

@ -56,7 +56,7 @@ Announcements.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
Announcements._collection._ensureIndex({ modifiedAt: -1 });
Announcements._collection.createIndex({ modifiedAt: -1 });
const announcements = Announcements.findOne({});
if (!announcements) {
Announcements.insert({ enabled: false, sort: 0 });

View file

@ -186,7 +186,7 @@ Attachments = new FS.Collection('attachments', {
if (Meteor.isServer) {
Meteor.startup(() => {
Attachments.files._ensureIndex({ cardId: 1 });
Attachments.files.createIndex({ cardId: 1 });
});
Attachments.allow({

View file

@ -1696,15 +1696,15 @@ Boards.before.insert((userId, doc) => {
if (Meteor.isServer) {
// Let MongoDB ensure that a member is not included twice in the same board
Meteor.startup(() => {
Boards._collection._ensureIndex({ modifiedAt: -1 });
Boards._collection._ensureIndex(
Boards._collection.createIndex({ modifiedAt: -1 });
Boards._collection.createIndex(
{
_id: 1,
'members.userId': 1,
},
{ unique: true },
);
Boards._collection._ensureIndex({ 'members.userId': 1 });
Boards._collection.createIndex({ 'members.userId': 1 });
});
// Genesis: the first activity of the newly created board

View file

@ -54,6 +54,6 @@ CardCommentReactions.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
CardCommentReactions._collection._ensureIndex({ cardCommentId: 1 }, { unique: true });
CardCommentReactions._collection.createIndex({ cardCommentId: 1 }, { unique: true });
});
}

View file

@ -178,8 +178,8 @@ if (Meteor.isServer) {
// Comments are often fetched within a card, so we create an index to make these
// queries more efficient.
Meteor.startup(() => {
CardComments._collection._ensureIndex({ modifiedAt: -1 });
CardComments._collection._ensureIndex({ cardId: 1, createdAt: -1 });
CardComments._collection.createIndex({ modifiedAt: -1 });
CardComments._collection.createIndex({ cardId: 1, createdAt: -1 });
});
CardComments.after.insert((userId, doc) => {

View file

@ -2991,14 +2991,14 @@ if (Meteor.isServer) {
// Cards are often fetched within a board, so we create an index to make these
// queries more efficient.
Meteor.startup(() => {
Cards._collection._ensureIndex({ modifiedAt: -1 });
Cards._collection._ensureIndex({ boardId: 1, createdAt: -1 });
Cards._collection.createIndex({ modifiedAt: -1 });
Cards._collection.createIndex({ boardId: 1, createdAt: -1 });
// https://github.com/wekan/wekan/issues/1863
// Swimlane added a new field in the cards collection of mongodb named parentId.
// When loading a board, mongodb is searching for every cards, the id of the parent (in the swinglanes collection).
// With a huge database, this result in a very slow app and high CPU on the mongodb side.
// To correct it, add Index to parentId:
Cards._collection._ensureIndex({ parentId: 1 });
Cards._collection.createIndex({ parentId: 1 });
// let notifydays = parseInt(process.env.NOTIFY_DUE_DAYS_BEFORE_AND_AFTER) || 2; // default as 2 days b4 and after
// let notifyitvl = parseInt(process.env.NOTIFY_DUE_AT_HOUR_OF_DAY) || 3600 * 24 * 1e3; // default interval as one day
// Meteor.call("findDueCards",notifydays,notifyitvl);

View file

@ -213,9 +213,9 @@ function publishChekListUncompleted(userId, doc) {
// Activities
if (Meteor.isServer) {
Meteor.startup(() => {
ChecklistItems._collection._ensureIndex({ modifiedAt: -1 });
ChecklistItems._collection._ensureIndex({ checklistId: 1 });
ChecklistItems._collection._ensureIndex({ cardId: 1 });
ChecklistItems._collection.createIndex({ modifiedAt: -1 });
ChecklistItems._collection.createIndex({ checklistId: 1 });
ChecklistItems._collection.createIndex({ cardId: 1 });
});
ChecklistItems.after.update((userId, doc, fieldNames) => {

View file

@ -195,8 +195,8 @@ Checklists.mutations({
if (Meteor.isServer) {
Meteor.startup(() => {
Checklists._collection._ensureIndex({ modifiedAt: -1 });
Checklists._collection._ensureIndex({ cardId: 1, createdAt: 1 });
Checklists._collection.createIndex({ modifiedAt: -1 });
Checklists._collection.createIndex({ cardId: 1, createdAt: 1 });
});
Checklists.after.insert((userId, doc) => {

View file

@ -231,8 +231,8 @@ function customFieldEdit(userId, doc) {
if (Meteor.isServer) {
Meteor.startup(() => {
CustomFields._collection._ensureIndex({ modifiedAt: -1 });
CustomFields._collection._ensureIndex({ boardIds: 1 });
CustomFields._collection.createIndex({ modifiedAt: -1 });
CustomFields._collection.createIndex({ boardIds: 1 });
});
CustomFields.after.insert((userId, doc) => {

View file

@ -121,8 +121,8 @@ Integrations.allow({
//INTEGRATIONS REST API
if (Meteor.isServer) {
Meteor.startup(() => {
Integrations._collection._ensureIndex({ modifiedAt: -1 });
Integrations._collection._ensureIndex({ boardId: 1 });
Integrations._collection.createIndex({ modifiedAt: -1 });
Integrations._collection.createIndex({ boardId: 1 });
});
/**

View file

@ -65,7 +65,7 @@ InvitationCodes.helpers({
if (Meteor.isServer) {
Meteor.startup(() => {
InvitationCodes._collection._ensureIndex({ modifiedAt: -1 });
InvitationCodes._collection.createIndex({ modifiedAt: -1 });
});
Boards.deny({
fetch: ['members'],

View file

@ -415,9 +415,9 @@ Lists.hookOptions.after.update = { fetchPrevious: false };
if (Meteor.isServer) {
Meteor.startup(() => {
Lists._collection._ensureIndex({ modifiedAt: -1 });
Lists._collection._ensureIndex({ boardId: 1 });
Lists._collection._ensureIndex({ archivedAt: -1 });
Lists._collection.createIndex({ modifiedAt: -1 });
Lists._collection.createIndex({ boardId: 1 });
Lists._collection.createIndex({ archivedAt: -1 });
});
Lists.after.insert((userId, doc) => {

View file

@ -218,8 +218,8 @@ if (Meteor.isServer) {
if (Meteor.isServer) {
// Index for Organization name.
Meteor.startup(() => {
// Org._collection._ensureIndex({ name: -1 });
Org._collection._ensureIndex({ orgDisplayName: 1 });
// Org._collection.createIndex({ name: -1 });
Org._collection.createIndex({ orgDisplayName: 1 });
});
}

View file

@ -74,8 +74,8 @@ OrgUser.attachSchema(
if (Meteor.isServer) {
// Index for Organization User.
Meteor.startup(() => {
OrgUser._collection._ensureIndex({ orgId: -1 });
OrgUser._collection._ensureIndex({ orgId: -1, userId: -1 });
OrgUser._collection.createIndex({ orgId: -1 });
OrgUser._collection.createIndex({ orgId: -1, userId: -1 });
});
}

View file

@ -87,7 +87,7 @@ Rules.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
Rules._collection._ensureIndex({ modifiedAt: -1 });
Rules._collection.createIndex({ modifiedAt: -1 });
});
}

View file

@ -147,7 +147,7 @@ Settings.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
Settings._collection._ensureIndex({ modifiedAt: -1 });
Settings._collection.createIndex({ modifiedAt: -1 });
const setting = Settings.findOne({});
if (!setting) {
const now = new Date();

View file

@ -331,8 +331,8 @@ Swimlanes.hookOptions.after.update = { fetchPrevious: false };
if (Meteor.isServer) {
Meteor.startup(() => {
Swimlanes._collection._ensureIndex({ modifiedAt: -1 });
Swimlanes._collection._ensureIndex({ boardId: 1 });
Swimlanes._collection.createIndex({ modifiedAt: -1 });
Swimlanes._collection.createIndex({ boardId: 1 });
});
Swimlanes.after.insert((userId, doc) => {

View file

@ -51,7 +51,7 @@ TableVisibilityModeSettings.allow({
if (Meteor.isServer) {
Meteor.startup(() => {
TableVisibilityModeSettings._collection._ensureIndex({ modifiedAt: -1 });
TableVisibilityModeSettings._collection.createIndex({ modifiedAt: -1 });
TableVisibilityModeSettings.upsert(
{ _id: 'tableVisibilityMode-allowPrivateOnly' },
{

View file

@ -216,7 +216,7 @@ if (Meteor.isServer) {
if (Meteor.isServer) {
// Index for Team name.
Meteor.startup(() => {
Team._collection._ensureIndex({ teamDisplayName: 1 });
Team._collection.createIndex({ teamDisplayName: 1 });
});
}

View file

@ -70,7 +70,7 @@ Triggers.helpers({
if (Meteor.isServer) {
Meteor.startup(() => {
Triggers._collection._ensureIndex({ modifiedAt: -1 });
Triggers._collection.createIndex({ modifiedAt: -1 });
});
}

View file

@ -56,8 +56,8 @@ if (Meteor.isServer) {
return userId === doc.userId && fieldNames.indexOf('userId') === -1;
}
Meteor.startup(() => {
UnsavedEditCollection._collection._ensureIndex({ modifiedAt: -1 });
UnsavedEditCollection._collection._ensureIndex({ userId: 1 });
UnsavedEditCollection._collection.createIndex({ modifiedAt: -1 });
UnsavedEditCollection._collection.createIndex({ userId: 1 });
});
UnsavedEditCollection.allow({
insert: isAuthor,

View file

@ -1661,12 +1661,12 @@ if (Meteor.isServer) {
// Let mongoDB ensure username unicity
Meteor.startup(() => {
allowedSortValues.forEach((value) => {
Lists._collection._ensureIndex(value);
Lists._collection.createIndex(value);
});
Users._collection._ensureIndex({
Users._collection.createIndex({
modifiedAt: -1,
});
Users._collection._ensureIndex(
Users._collection.createIndex(
{
username: 1,
},

11
package-lock.json generated
View file

@ -535,6 +535,11 @@
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
@ -838,9 +843,9 @@
}
},
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
"version": "3.21.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.21.0.tgz",
"integrity": "sha512-YUdI3fFu4TF/2WykQ2xzSiTQdldLB4KVuL9WeAy5XONZYt5Cun/fpQvctoKbCgvPhmzADeesTk/j2Rdx77AcKQ=="
},
"core-util-is": {
"version": "1.0.2",