Improved getLastTransaction from 12s to 0.26s
MODIFY
src/storage/mongodb/MongoDBStorage.ts
src/storage/mongodb/MongoDBStorage.ts
@@ -167,6 +167,7 @@ export default class MongoDBStorage {
]);
// Transactions
await this.handleIndexesInCollection(tenantID, 'transactions', [
+ { fields: { timestamp: 1 } },
{ fields: { issuer: 1, timestamp: 1 } },
{ fields: { chargeBoxID: 1 } },
{ fields: { tagID: 1 } },

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -1235,6 +1235,7 @@ export default class TransactionStorage {
// Authorization window
aggregation.push({
$match: {
+ issuer: true,
timestamp: {
$gt: Utils.convertToDate(authorizeStartDate),
$lt: Utils.convertToDate(authorizeEndDate)

Improved getLastTransaction from 12s to 0.26s