Skip to content

Add indexes type tests for wildcard#679

Open
vic-tsang wants to merge 3 commits into
documentdb:mainfrom
vic-tsang:indexes/types/wildcard
Open

Add indexes type tests for wildcard#679
vic-tsang wants to merge 3 commits into
documentdb:mainfrom
vic-tsang:indexes/types/wildcard

Conversation

@vic-tsang

Copy link
Copy Markdown
Collaborator

This PR contains:

  • indexes type tests for wildcard

Ref:

Signed-off-by: Victor [C] Tsang <vitsangp@amazon.com>
@vic-tsang vic-tsang requested a review from a team as a code owner July 11, 2026 00:09
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jul 11, 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 L · Status Needs Review
Confidence: 0.85 (mixed)

Reasoning

component from path globs (test-coverage, test-framework); effort from diff stats (1994+0 LOC, 7 files); LLM: Adds new wildcard index type test cases to the compatibility test suite, expanding test coverage for an existing feature.

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.

Signed-off-by: Victor Tsang <vitsangp@amazon.com>
@vic-tsang vic-tsang force-pushed the indexes/types/wildcard branch from fcf03e7 to 8cb12af Compare July 16, 2026 00:48
Signed-off-by: Victor Tsang <vitsangp@amazon.com>


WILDCARD_BSON_PARAMS = [
BsonTypeTestCase(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wildcardProjection BSON test only checks OBJECT is accepted and non-object types are rejected as TYPE_MISMATCH_ERROR.

)
assertFailureCode(result, test.expected, msg=test.msg)


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a case for wildcardProjection mixing inclusion/exclusion inside the nested-object form (e.g. {"a": {"b": 1, "c": 0}})

assertFailureCode(result, test.expected, msg=test.msg)


INVALID_PROJECTION_TESTS: list[IndexTestCase] = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a case for a dotted-path/parent-child collision in wildcardProjection (e.g. {"a": 1, "a.b": 0}).

expected=[{"_id": 2, "x": {"y": 1}}],
msg="Nested match on polymorphic field",
),
IndexQueryTestCase(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a case that replaces a scalar array element with an object via $set (e.g. a: [1,2,3] → $set: {"a.1": {b: 5}}) and then queries the new subpath (a.b).

{"createIndexes": collection.name, "indexes": list(test.indexes)},
)
assertSuccessPartial(result, {"numIndexesAfter": 2, "ok": 1.0}, msg=test.msg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a scoped-wildcard-plus-prefix-field-with-projection case (e.g. {"a": 1, "sub.$**": 1} + wildcardProjection).

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.

2 participants