Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/server/models/_Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { BaseDb } from './_BaseDb';
import { oplogEvents } from '../oplogEvents';

export class Base {
constructor(nameOrModel) {
this._db = new BaseDb(nameOrModel, this);
constructor(nameOrModel, options) {
this._db = new BaseDb(nameOrModel, this, options);
this.model = this._db.model;
this.collectionName = this._db.collectionName;
this.name = this._db.name;
Expand Down
4 changes: 2 additions & 2 deletions app/models/server/models/_BaseDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ try {
}

export class BaseDb extends EventEmitter {
constructor(model, baseModel) {
constructor(model, baseModel, options = {}) {
super();

if (Match.test(model, String)) {
Expand Down Expand Up @@ -68,7 +68,7 @@ export class BaseDb extends EventEmitter {
};
this.on('newListener', handleListener);

this.tryEnsureIndex({ _updatedAt: 1 });
this.tryEnsureIndex({ _updatedAt: 1 }, options._updatedAtIndexOptions);
}

get baseName() {
Expand Down
3 changes: 1 addition & 2 deletions app/models/server/models/apps-logs-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Base } from './_Base';

export class AppsLogsModel extends Base {
constructor() {
super('apps_logs');
super('apps_logs', { _updatedAtIndexOptions: { expireAfterSeconds: 60 * 60 * 24 * 30 } });

this.tryEnsureIndex({ appId: 1 });
this.tryEnsureIndex({ _updatedAt: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
}

// Bypass trash collection
Expand Down