Skip to content

CSHARP-5882, CSHARP-5884, and CSHARP-5762#1900

Open
ajcvickers wants to merge 3 commits intomongodb:mainfrom
ajcvickers:CSHARP-5884b
Open

CSHARP-5882, CSHARP-5884, and CSHARP-5762#1900
ajcvickers wants to merge 3 commits intomongodb:mainfrom
ajcvickers:CSHARP-5884b

Conversation

@ajcvickers
Copy link
Contributor

@ajcvickers ajcvickers commented Mar 5, 2026

CSHARP-5882: Support stored source in vector indexes

Allows fields to be included or excluded. Does not allow true to be set because this will always fail for a vector index.

CSHARP-5884: Add new fields for Auto embedding in Atlas Vector search indexes

CSHARP-5762: Vector search against nested embeddings and arrays of embeddings

Copilot AI review requested due to automatic review settings March 5, 2026 10:55
@ajcvickers ajcvickers requested a review from a team as a code owner March 5, 2026 10:55
@ajcvickers ajcvickers requested a review from adelinowona March 5, 2026 10:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements support for storedSource configuration in vector search indexes, allowing users to specify which fields should be included or excluded from the Atlas vector index's stored source. The implementation deliberately avoids supporting true as a value (which would always fail for vector indexes, per the description).

Changes:

  • Added IncludedStoredFields and ExcludedStoredFields properties and a RenderStoredSource helper method to CreateVectorSearchIndexModelBase<TDocument>.
  • Added WithIncludedStoredFields and WithExcludedStoredFields fluent methods (both field-definition and expression-based overloads) to CreateVectorSearchIndexModel<TDocument> and CreateAutoEmbeddingVectorSearchIndexModel<TDocument>, and updated their Render methods to emit the storedSource BSON.
  • Updated integration tests in AtlasSearchIndexManagmentTests.cs to verify the new stored source behavior, changed the poll period from 5s to 10s, and refactored GetIndexes to accept expectTimeout as an explicit parameter.

Reviewed changes

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

File Description
src/MongoDB.Driver/CreateVectorSearchIndexModelBase.cs Adds IncludedStoredFields, ExcludedStoredFields properties and RenderStoredSource helper; minor doc comment issue
src/MongoDB.Driver/CreateVectorSearchIndexModel.cs Adds WithIncludedStoredFields/WithExcludedStoredFields fluent methods and calls RenderStoredSource in Render
src/MongoDB.Driver/CreateAutoEmbeddingVectorSearchIndexModel.cs Same pattern as CreateVectorSearchIndexModel.cs for auto-embedding variant
tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs Integration tests for new storedSource behavior; poll period, expectTimeout refactor, minor naming/formatting issues

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ajcvickers ajcvickers changed the title CSHARP-5884: Support stored source in vector indexes CSHARP-5882: Support stored source in vector indexes Mar 5, 2026
@ajcvickers ajcvickers added the feature Adds new user-facing functionality. label Mar 5, 2026
@ajcvickers ajcvickers changed the title CSHARP-5882: Support stored source in vector indexes CSHARP-5882 and CSHARP-5884 Mar 5, 2026
@ajcvickers ajcvickers requested a review from Copilot March 5, 2026 12:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs:578

  • Lines 570-572 assert that numDimensions, similarity, and quantization exist in the indexField document with specific values, but lines 576-578 immediately assert those same fields do NOT exist (Should().Be(false)). This is a direct contradiction — both sets of assertions cannot be true at the same time. Lines 576-578 appear to be leftover from the "required only options" test (which copied the pattern of asserting optional fields are absent) and should be removed since this test explicitly configures all those options.
            indexField.Contains("quantization").Should().Be(false);
            indexField.Contains("numDimensions").Should().Be(false);
            indexField.Contains("similarity").Should().Be(false);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ajcvickers ajcvickers force-pushed the CSHARP-5884b branch 2 times, most recently from e81af22 to 8b0ebd1 Compare March 5, 2026 13:23
@ajcvickers
Copy link
Contributor Author

Verified Evergreen failure not due to this PR.

@codeowners-service-app
Copy link

codeowners-service-app bot commented Mar 9, 2026

Assigned jordan-smith721 for team dbx-csharp-dotnet because adelinowona is out of office.
Assigned jordan-smith721 for team dbx-csharp-dotnet because adelinowona is out of office.

@ajcvickers ajcvickers changed the title CSHARP-5882 and CSHARP-5884 CSHARP-5882, CSHARP-5884, and CSHARP-5762 Mar 9, 2026
@ajcvickers ajcvickers requested a review from Copilot March 9, 2026 11:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs:689

  • In Can_create_autoEmbed_vector_index_for_all_options, lines 681–685 assert that indexField["numDimensions"], indexField["similarity"], and indexField["quantization"] exist with specific values, but then lines 687–689 immediately assert that the same fields do NOT exist (.Should().Be(false)). These assertions directly contradict each other and the test will always fail at the last three assertions (or would never actually validate the first set correctly). The three negative assertions at lines 687–689 appear to be leftover copy-paste from the Can_create_autoEmbed_vector_index_for_required_only_options test, which correctly validates the absence of those optional fields. They should be removed from the all-options test.
            indexField.Contains("quantization").Should().Be(false);
            indexField.Contains("numDimensions").Should().Be(false);
            indexField.Contains("similarity").Should().Be(false);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Allows fields to be included or excluded. Does not allow `true` to be set because this will always fail for a vector index.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adds new user-facing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants