Skip to content

Commit bf23fbb

Browse files
committed
chore: docs
1 parent ff73b41 commit bf23fbb

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

test/benchmarks/driver_bench/readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ npm start
1010

1111
will build the benchmarks and run them.
1212

13+
## Environment Configuration and Setup
14+
15+
The benchmarks respond to a few environment variables:
16+
17+
- `MONGODB_URI`
18+
- The connection string to run operations against.
19+
CI uses a standalone, you should be able to launch any cluster and point the benchmarks at it via this env var.
20+
- default: `"mongodb://localhost:27017"`
21+
- `MONGODB_DRIVER_PATH`
22+
- The path to the MongoDB Node.js driver.
23+
This MUST be set to the _directory_ the driver is installed in.
24+
**NOT** the file "lib/index.js" that is the driver's export.
25+
- default: 4 directories above driver.mjs (should be the root of this repo)
26+
- `MONGODB_CLIENT_OPTIONS`
27+
- A JSON string that will be passed to the MongoClient constructor
28+
- default: `"{}"`
29+
1330
## Running individual benchmarks
1431

1532
`main.mjs` loops and launches the bench runner for you.

test/benchmarks/driver_bench/src/driver.mts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ export const MONGODB_CLIENT_OPTIONS = (() => {
8888
})();
8989

9090
export const MONGODB_URI = (() => {
91-
if (process.env.MONGODB_URI?.length) return process.env.MONGODB_URI;
92-
return 'mongodb://127.0.0.1:27017';
91+
const connectionString = process.env.MONGODB_URI;
92+
if (connectionString?.length) {
93+
return connectionString;
94+
}
95+
return 'mongodb://localhost:27017';
9396
})();
9497

9598
export function snakeToCamel(name: string) {

0 commit comments

Comments
 (0)