Skip to content

Commit 9ff16d8

Browse files
committed
Fixes
1 parent 49c3750 commit 9ff16d8

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using MongoDB.Bson;Add commentMore actions
2+
using MongoDB.Bson.Serialization.Conventions;
3+
using MongoDB.Driver;
4+
5+
public class Program
6+
{
7+
public static void Main(string[] args)
8+
{
9+
// Replace with your connection string
10+
const string uri = "<connection string>";
11+
12+
var mongoClient = new MongoClient(uri);
13+
var database = mongoClient.GetDatabase("db");
14+
var _collection = database.GetCollection<Line>("lines");
15+
16+
var line = new Line
17+
{
18+
X = new Memory<int>(new[] { 1, 2, 3, 4, 5 }),
19+
Y = new ReadOnlyMemory<float>(new[] { 1f, 1.41f, 1.73f, 2f, 2.24f })
20+
};
21+
22+
var filter = Builders<Line>.Filter.Empty;
23+
24+
var result = _collection.Find(filter).FirstOrDefault().ToJson();
25+
Console.WriteLine(result);
26+
}
27+
28+
}
29+
30+
// start-line-class
31+
public class Line
32+
{
33+
public ObjectId Id { get; set; }
34+
public Memory<int> X { get; set; }
35+
public ReadOnlyMemory<float> Y { get; set; }
36+
}
37+
// end-line-class

source/serialization.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ represented in MongoDB:
244244

245245
:ref:`csharp-atlas-vector-search` involves creating and querying
246246
large numerical arrays. If your application uses
247-
{+vector-search+}, you might benefit from the performance
247+
{+avs+}, you might benefit from the performance
248248
improvements from using ``Memory`` and ``ReadOnlyMemory`` to store
249249
array representations of embeddings and query vectors. To learn more,
250-
see :ref:`csharp-supported-vector-types` in the {+vector-search+} guide.
250+
see :ref:`csharp-supported-vector-types` in the {+avs+} guide.
251251

252252
Additional Information
253253
----------------------

0 commit comments

Comments
 (0)