mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-04 11:28:57 +02:00
perf: convert expireAt index to partial
no need to store null in index for all documents
This commit is contained in:
@@ -87,9 +87,13 @@ mongoModule.createIndices = async function () {
|
||||
await collection.createIndex({ _key: 1, score: -1 }, { background: true });
|
||||
await collection.createIndex({ _key: 1, value: -1 }, { background: true, unique: true, sparse: true });
|
||||
await collection.createIndex(
|
||||
{ members: 1, _key: 1}, { background: true, partialFilterExpression: { members: { $exists: true } } }
|
||||
{ members: 1, _key: 1},
|
||||
{ background: true, partialFilterExpression: { members: { $exists: true } } }
|
||||
);
|
||||
await collection.createIndex(
|
||||
{ expireAt: 1 },
|
||||
{ expireAfterSeconds: 0, background: true, partialFilterExpression: { expireAt: { $exists: true } } },
|
||||
);
|
||||
await collection.createIndex({ expireAt: 1 }, { expireAfterSeconds: 0, background: true });
|
||||
winston.info('[database] Checking database indices done!');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user