Skip to content

Add $minN array element tests for null filtering and n validation#651

Open
andavag wants to merge 3 commits into
documentdb:mainfrom
andavag:main
Open

Add $minN array element tests for null filtering and n validation#651
andavag wants to merge 3 commits into
documentdb:mainfrom
andavag:main

Conversation

@andavag

@andavag andavag commented Jun 28, 2026

Copy link
Copy Markdown

What does this PR do?

Adds second-pass compatibility coverage for the $minN array expression operator.

This PR adds tests for:

  • filtering null values from $minN array input
  • returning all available non-null values when n is larger than the number of usable values
  • rejecting invalid n: 0 input with the expected MongoDB error code

Why was this PR needed?

Issue #201 asks for additional $minN array expression compatibility coverage beyond the existing smoke test. The existing test confirms the basic happy path, but it does not cover edge behavior such as null handling or validation of invalid n values.

These tests help document expected MongoDB-compatible behavior and protect against future regressions.

How did you test it?

Focused tests passed against local MongoDB:

python -m pytest documentdb_tests/compatibility/tests/core/operator/expressions/array/minN-array-element/test_minN-array-element_null_filtering.py documentdb_tests/compatibility/tests/core/operator/expressions/array/minN-array-element/test_minN-array-element_n_validation.py --connection-string "mongodb://localhost:27017/?serverSelectionTimeoutMS=2000" --engine-name mongodb

andavag and others added 3 commits June 21, 2026 23:29
Signed-off-by: Andranik Avagyan <ando.avagyan.2015@gmail.com>
Add minN array element compatibility tests
@andavag andavag requested a review from a team as a code owner June 28, 2026 07:36
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 28, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, enhancement
Project fields suggested: Component test-coverage · Priority P2 · Effort M · Status Needs Review
Confidence: 0.30 (deterministic)

Reasoning

component from path globs (test-coverage, test-framework); effort from diff stats (76+0 LOC, 3 files); LLM failed: Invalid response body while trying to fetch https://api.anthropic.com/v1/messages: Premature close

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant