Skip to content

Add indexes type tests for wildcard#679

Open
vic-tsang wants to merge 1 commit into
documentdb:mainfrom
vic-tsang:indexes/types/wildcard
Open

Add indexes type tests for wildcard#679
vic-tsang wants to merge 1 commit 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.


pytestmark = pytest.mark.index


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we also test all the other data types, including special, scalars, objects and arrays

from documentdb_tests.framework.parametrize import pytest_params

pytestmark = pytest.mark.index

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we include cases for path specific wildcard , wildcard projection , compound wildcard ?

from documentdb_tests.framework.parametrize import pytest_params

pytestmark = pytest.mark.index

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we add, compound wildcard where the non-wildcard prefix field is multikey (array)

)
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.

Can we add a test case for compound wildcard with an overlapping field in both wildcard scope and regular key, without wildcardProjection exclusion

result, {"value": {"_id": 2, "a": 99}, "ok": 1.0}, msg="Hinted findAndModify via wildcard"
)


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we have a test case like, Overwrite an existing nested field via $set (not just adding a new field)` and check dynamic field is indexed after update

expected=[{"_id": 1, "a": {}}],
msg="Empty-document equality served by wildcard (documented exception)",
),
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.

Can we also have a case for, Multikey dedup for array-of-subdocuments on $exists/range queries

hint="wc_id",
expected=[{"_id": 2, "a": 2}],
msg="Hinted _id query works when _id included in wildcardProjection",
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we add a test case, query on _id subfields via a scoped "_id.$**" index

result = execute_command(collection, {"dropIndexes": collection.name, "index": test.input})
assertSuccessPartial(result, {"nIndexesWas": 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.

can we also add a test case, Two compound wildcard indexes with same prefix but different/overlapping wildcard scopes (conflict/coexistence)

pytestmark = pytest.mark.index


WILDCARD_BSON_PARAMS = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we have case , BSON type validation of values inside wildcardProjection (e.g. {"a": "yes"} instead of 0/1), may be in error case ?

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