Skip to content

.Net: Add support for Guid and ObjectID keys in the MongoDB Connector#12827

Merged
westey-m merged 13 commits into
microsoft:mainfrom
damieng:mongodb-new-key-types
Aug 18, 2025
Merged

.Net: Add support for Guid and ObjectID keys in the MongoDB Connector#12827
westey-m merged 13 commits into
microsoft:mainfrom
damieng:mongodb-new-key-types

Conversation

@damieng

@damieng damieng commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

Motivation and Context

The MongoDB connector currently only supports string key types.

Description

Adds support for Guid and ObjectId key types to the MongoDB Connector.

Contribution Checklist

@damieng damieng requested a review from a team as a code owner July 30, 2025 10:42
@moonbox3 moonbox3 added the .NET Issue or Pull requests regarding .NET code label Jul 30, 2025
@damieng damieng changed the title .NET: Add support for Guid and ObjectID keys in the MongoDB Connector .Net: Add support for Guid and ObjectID keys in the MongoDB Connector Jul 30, 2025
Comment thread dotnet/src/VectorData/MongoDB/MongoCollection.cs Outdated
@westey-m

Copy link
Copy Markdown
Contributor

@damieng, looks like there's still one unit test failing:

  Failed SemanticKernel.Connectors.MongoDB.UnitTests.MongoVectorStoreTests.GetCollectionWithNotSupportedKeyThrowsException [89 ms]
  Error Message:
   Assert.Throws() Failure: No exception was thrown
Expected: typeof(System.NotSupportedException)
  Stack Trace:
     at SemanticKernel.Connectors.MongoDB.UnitTests.MongoVectorStoreTests.GetCollectionWithNotSupportedKeyThrowsException() in /home/runner/work/semantic-kernel/semantic-kernel/dotnet/test/VectorData/MongoDB.UnitTests/MongoVectorStoreTests.cs:line 29
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)```

@westey-m westey-m enabled auto-merge August 15, 2025 15:41
@westey-m westey-m added this pull request to the merge queue Aug 15, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 15, 2025
@westey-m westey-m added this pull request to the merge queue Aug 18, 2025
Merged via the queue into microsoft:main with commit 0a98c72 Aug 18, 2025
22 of 25 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Sep 8, 2025
### Motivation and Context

The ObjectID and Guid string support work in #12827 did not include
support for the method overloads that take an IEnumerable of keys. I
suspect this was due to merge/out of sync branches and was then missed
with the tests being disabled (they now pass).

### Description

Adds the support for Guid and ObjectID keys to the GetAsync, DeleteAsync
and UpdateAsync methods that take an IEnumerable.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
jcruzmot-te pushed a commit to thousandeyes/aia-semantic-kernel that referenced this pull request Sep 15, 2025
…microsoft#12827)

### Motivation and Context

The MongoDB connector currently only supports string key types.

### Description

Adds support for Guid and ObjectId key types to the MongoDB Connector. 

### Contribution Checklist

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants