query: support bare regex filter values and array-index dot paths

The Node driver sends {field: /re/} as a BSON regex element (type 0x0B),
which the matcher previously only handled via the $regex operator form;
and dot paths with numeric segments (tags.0) were ignored because array
descent only recursed into embedded docs. Both are part of standard
MongoDB query semantics and were caught by the driver e2e suite.

server: unbounded Io async limit so the accept loop never wedges, and
treat header-read failures (client RST on pool teardown) as clean
disconnects. With the default cpu_count-1 limit, groupAsync's eager
fallback ran connection handlers inline on the accept-loop fiber once
that many connections were alive, stalling accept() and timing out
handshakes for further clients.

Add tests/e2e/: official driver CRUD, concurrency, and kill -9 recovery
suites (29 + 2 + 3 checks), plus unit tests for the query fixes.
This commit is contained in:
mongo-light
2026-08-02 10:56:43 +03:00
parent 4b975d1c93
commit c29c09d6e8
5 changed files with 315 additions and 9 deletions

29
tests/e2e/README.md Normal file
View File

@@ -0,0 +1,29 @@
# End-to-end tests with the official MongoDB Node.js driver
These exercise mongo-light from a real driver over TCP: full CRUD, query
operators, aggregation, error codes, concurrent clients, and crash recovery.
## Setup
```sh
cd tests/e2e
npm init -y >/dev/null
npm install mongodb
```
## Run
Start the server, then run the suites against it (defaults to port 27020):
```sh
zig build
zig-out/bin/mongo-light --port 27020 --db /tmp/ml-e2e.log &
node tests/e2e/e2e.js # CRUD + operators + aggregate + errors (29 checks)
node tests/e2e/e2e2.js concurrent # 8 clients: 4 writers + 4 readers (2 checks)
node tests/e2e/e2e2.js crash-a # write 50 docs, then kill -9 the server
node tests/e2e/e2e2.js crash-b # restart and verify all 50 survived
```
`e2e2.js concurrent` is safe to repeat against a running server (it drops its
collection first); `crash-a`/`crash-b` are two halves of one scenario.