Skip to content

Commit 161b49b

Browse files
committed
Add support for Guid in other Enumerables like ReadOnly.
1 parent 0915d94 commit 161b49b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dotnet/src/VectorData/MongoDB/BsonValueFactory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

33
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
46
using MongoDB.Bson;
57

68
namespace Microsoft.SemanticKernel.Connectors.MongoDB;
@@ -20,8 +22,9 @@ public static BsonValue Create(object? value)
2022
{
2123
null => BsonNull.Value,
2224
Guid guid => new BsonBinaryData(guid, GuidRepresentation.Standard),
23-
Guid[] guids => new BsonArray(Array.ConvertAll(guids, x => new BsonBinaryData(x, GuidRepresentation.Standard))),
25+
Object[] array => new BsonArray(Array.ConvertAll(array, Create)),
2426
Array array => new BsonArray(array),
27+
IEnumerable<Object> enumerable => new BsonArray(enumerable.Select(Create)),
2528
_ => BsonValue.Create(value)
2629
};
2730
}

0 commit comments

Comments
 (0)