Table of Contents

Class ObjectIdConverter

Namespace
DataStax.AstraDB.DataApi.SerDes
Assembly
DataStax.AstraDB.DataApi.dll

A custom converter to handle serialization and deserialization of ObjectId values

public class ObjectIdConverter : JsonConverter<ObjectId>
Inheritance
JsonConverter<ObjectId>
ObjectIdConverter
Inherited Members

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts JSON to an MongoDB.Bson.ObjectId value.

public override ObjectId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader
typeToConvert Type
options JsonSerializerOptions

Returns

ObjectId

Write(Utf8JsonWriter, ObjectId, JsonSerializerOptions)

Writes an MongoDB.Bson.ObjectId value as a JSON object with a $objectId property.

public override void Write(Utf8JsonWriter writer, ObjectId value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter
value ObjectId
options JsonSerializerOptions