mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: db.fixExpireAfter: ignore system collection
This commit is contained in:
1 file changed
+2
@@ -74,7 +74,9 @@ export class MongoService extends Service {
|
|||||||
public async fixExpireAfter() {
|
public async fixExpireAfter() {
|
||||||
// Sometimes mongo's expireAfterSeconds is not working in non-replica set mode;
|
// Sometimes mongo's expireAfterSeconds is not working in non-replica set mode;
|
||||||
const collections = await this.db.listCollections().toArray();
|
const collections = await this.db.listCollections().toArray();
|
||||||
|
const ignore = ['system.profile', 'system.users', 'system.version', 'system.views'];
|
||||||
for (const c of collections) {
|
for (const c of collections) {
|
||||||
|
if (ignore.includes(c.name)) continue;
|
||||||
const coll = this.db.collection(c.name);
|
const coll = this.db.collection(c.name);
|
||||||
const indexes = await coll.listIndexes().toArray();
|
const indexes = await coll.listIndexes().toArray();
|
||||||
for (const i of indexes) {
|
for (const i of indexes) {
|
||||||
|
|||||||
Reference in new issue
Block a user