Problem
billing.extraBalance.listLedger.perf.integration.tests.js fails locally on MongoDB 5.0.x:
MongoServerError: Invalid $project :: caused by :: Unrecognized expression '$sortArray'
$sortArray was added in MongoDB 5.2. The test + repository code (billing.extraBalance.repository.js line ~370) use $sortArray in an aggregation pipeline, which is unavailable in MongoDB 5.0.x.
Observed: MongoDB 5.0.7 local dev env (macOS, homebrew), 3 tests fail.
Passes: CI (ARC runner uses mongo:7, supports $sortArray).
Affected file(s)
modules/billing/repositories/billing.extraBalance.repository.js (line ~370)
modules/billing/tests/billing.extraBalance.listLedger.perf.integration.tests.js
Steps to reproduce
- Install MongoDB 5.0.x locally (
brew install mongodb-community@5.0)
- Run
NODE_ENV=trawl npm run test:integration -- --testPathPatterns=billing.extraBalance.listLedger
- Observe
MongoServerError: Unrecognized expression '$sortArray'
Suggested fix
Options:
- Document MongoDB >= 5.2 as minimum required version in README + STRIPE_SETUP.md
- Add a skip guard in the test:
if (mongoVersion < '5.2') test.skip(...)
- Use a sort-then-slice alternative (
$unwind + $sort + $group) for compatibility
CI will pass regardless (mongo:7). This is a local DX issue discovered during /update-stack from trawl_node.
Problem
billing.extraBalance.listLedger.perf.integration.tests.jsfails locally on MongoDB 5.0.x:$sortArraywas added in MongoDB 5.2. The test + repository code (billing.extraBalance.repository.jsline ~370) use$sortArrayin an aggregation pipeline, which is unavailable in MongoDB 5.0.x.Observed: MongoDB 5.0.7 local dev env (macOS, homebrew), 3 tests fail.
Passes: CI (ARC runner uses
mongo:7, supports$sortArray).Affected file(s)
modules/billing/repositories/billing.extraBalance.repository.js(line ~370)modules/billing/tests/billing.extraBalance.listLedger.perf.integration.tests.jsSteps to reproduce
brew install mongodb-community@5.0)NODE_ENV=trawl npm run test:integration -- --testPathPatterns=billing.extraBalance.listLedgerMongoServerError: Unrecognized expression '$sortArray'Suggested fix
Options:
if (mongoVersion < '5.2') test.skip(...)$unwind+$sort+$group) for compatibilityCI will pass regardless (mongo:7). This is a local DX issue discovered during
/update-stackfrom trawl_node.