Skip to content

Add tests for slice, sort, merge, out, text, bit#627

Open
SarthakDalmia1 wants to merge 3 commits into
documentdb:mainfrom
SarthakDalmia1:users/sadalmia/compat_tests_part4
Open

Add tests for slice, sort, merge, out, text, bit#627
SarthakDalmia1 wants to merge 3 commits into
documentdb:mainfrom
SarthakDalmia1:users/sadalmia/compat_tests_part4

Conversation

@SarthakDalmia1

Copy link
Copy Markdown

This is part of the #618 issue

@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 19, 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 In Progress
Confidence: 0.75 (mixed)

Reasoning

component from path globs (test-coverage); effort from diff stats (876+0 LOC, 7 files); LLM: Adds new compatibility test cases for multiple operators/stages (slice, sort, merge, out, text, bit) as part of a tracked issue, expanding test coverage across several areas.

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.

@SarthakDalmia1 SarthakDalmia1 marked this pull request as ready for review July 10, 2026 10:37
@SarthakDalmia1 SarthakDalmia1 requested a review from a team as a code owner July 10, 2026 10:37
Copilot AI review requested due to automatic review settings July 10, 2026 10:37
@SarthakDalmia1 SarthakDalmia1 force-pushed the users/sadalmia/compat_tests_part4 branch from 4d3e11b to 72927cf Compare July 10, 2026 10:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds new compatibility test coverage for Issue #618 by extending the functional test suite across several update operators/modifiers and aggregation/query features. These tests aim to lock in MongoDB parity for modifier interaction/order ($slice/$sort/$position), command-path behavior for $bit, $out/$merge stage composition, and $text + textScore placement/validation rules.

Changes:

  • Add new $push modifier interaction tests covering $sort + $position, and $slice combined with $sort/$position.
  • Add $bit tests across additional command paths (findAndModify and a bulk-write scenario).
  • Add new aggregation stage composition tests for $out (bucketing/window family) and $merge (integration with common pipeline stages), plus richer $text query tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
documentdb_tests/compatibility/tests/core/operator/update/modifiers/sort/test_update_sort_with_position.py New parametrized tests for $push $sort behavior when combined with $position.
documentdb_tests/compatibility/tests/core/operator/update/modifiers/slice/test_update_slice_combined_modifiers.py New parametrized tests validating documented modifier-processing order for $slice with $sort/$position.
documentdb_tests/compatibility/tests/core/operator/update/bitwise/bit/test_bit_command_paths.py Adds $bit coverage via findAndModify and a bulk-write path.
documentdb_tests/compatibility/tests/core/operator/stages/test_stages_combination_out_bucketing.py Adds $out composition coverage with bucketing and window stages, plus $bucketAuto + $out.
documentdb_tests/compatibility/tests/core/operator/stages/test_stages_combination_merge.py Adds $merge pipeline-integration tests mirroring existing composition patterns.
documentdb_tests/compatibility/tests/core/operator/query/text/test_text_meta_score_placement.py Adds tests for $meta: "textScore" placement rules and metadata-not-available validation.
documentdb_tests/compatibility/tests/core/operator/query/text/test_text_compound_predicates.py Adds $text compound predicate intersection tests (implicit/explicit $and, range, $in, $ne, etc.).

def test_bit_bulk_write_update_one(collection):
"""$bit applied through a batched bulk write produces the bitwise result."""
collection.insert_one({"_id": 1, "v": 13})
collection.bulk_write([UpdateOne({"_id": 1}, {"$bit": {"v": {"and": 10}}})])
]


def run_find_and_modify(collection, test: BitFindAndModifyTest):
pytestmark = pytest.mark.find


def _create_text_index(collection):
SarthakDalmia1 and others added 3 commits July 10, 2026 10:47
Signed-off-by: SarthakDalmia1 <sarthak.dalmia1@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cffb5410-c08b-4dad-bf0d-7f84c758fa37
Signed-off-by: SarthakDalmia1 <sarthak.dalmia1@gmail.com>
…go engine_xfail markers

Remove the engine_xfail(engine="pgmongo") markers from the $out-after-$bucketAuto
and $slice-0 combined-modifier cases. pgmongo is not a configured engine (only
mongodb is wired up in dev/compose.yaml), so these markers are inert no-ops; per
the DocumentDB test conventions, engine divergences are tracked in the DocumentDB
repo rather than via engine_xfail here. The tests continue to assert native
MongoDB (oracle) behavior. Docstrings updated to drop the "tracked engine
divergence" framing accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cffb5410-c08b-4dad-bf0d-7f84c758fa37
Signed-off-by: SarthakDalmia1 <sarthak.dalmia1@gmail.com>
@SarthakDalmia1 SarthakDalmia1 force-pushed the users/sadalmia/compat_tests_part4 branch from 69768a4 to cb78ae3 Compare July 10, 2026 10:48
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