Skip to content

Commit 08247aa

Browse files
committed
Small fixes
1 parent 43ea9c2 commit 08247aa

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

src/MongoDB.Bson/IO/IBsonReader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
namespace MongoDB.Bson.IO
1919
{
20-
//FP This interface should have the settingg property as well, same way it's done for thr writer
20+
//DOMAIN-API This interface should have the setting property as well probably., same way it's done for thr writer.
21+
//Even if we don't need it now, it could be needed in the future.
2122
/// <summary>
2223
/// Represents a BSON reader.
2324
/// </summary>

src/MongoDB.Bson/Serialization/BsonSerializer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static BsonSerializer()
3434
_serializationDomain = new BsonSerializationDomain("MAIN");
3535
}
3636

37+
//QUESTION I think we should have another property here, called StandardSerializationDomain, which would have only the standard serializers and conventions registered.
3738
internal static IBsonSerializationDomain DefaultSerializationDomain => _serializationDomain;
3839

3940
// public static properties

src/MongoDB.Bson/Serialization/IBsonSerializationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ internal interface IDomainAwareBsonSerializationProvider : IRegistryAwareBsonSer
5555
{
5656
IBsonSerializationDomain SerializationDomain { get; }
5757

58-
//FP Can't use just GetSerializer because it's already used by the base interface.
58+
//FP Can't use just GetSerializer name because it's already used by the base interface.
5959
IBsonSerializer GetSerializerWithDomain(Type type);
6060
}
6161
}

src/MongoDB.Driver.Encryption/ExplicitEncryptionLibMongoCryptController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public Guid CreateDataKey(
102102
{
103103
var wrappedKeyBytes = ProcessStates(context, _keyVaultNamespace.DatabaseNamespace.DatabaseName, cancellationToken);
104104

105-
var wrappedKeyDocument = BsonSerializer.Deserialize<BsonDocument>(wrappedKeyBytes); //FP I think this is fine, as it should be default configuration.
105+
var wrappedKeyDocument = BsonSerializer.Deserialize<BsonDocument>(wrappedKeyBytes); //FP I think this is fine for now, this should use the standard domain.
106106
var keyId = UnwrapKeyId(wrappedKeyDocument);
107107

108108
_keyVaultCollection.Value.InsertOne(wrappedKeyDocument, cancellationToken: cancellationToken);
@@ -131,7 +131,7 @@ public async Task<Guid> CreateDataKeyAsync(
131131
{
132132
var wrappedKeyBytes = await ProcessStatesAsync(context, _keyVaultNamespace.DatabaseNamespace.DatabaseName, cancellationToken).ConfigureAwait(false);
133133

134-
var wrappedKeyDocument = BsonSerializer.Deserialize<BsonDocument>(wrappedKeyBytes); //FP I think this is fine, as it should be default configuration.
134+
var wrappedKeyDocument = BsonSerializer.Deserialize<BsonDocument>(wrappedKeyBytes); //FP I think this is fine for now, this should use the standard domain.
135135
var keyId = UnwrapKeyId(wrappedKeyDocument);
136136

137137
await _keyVaultCollection.Value.InsertOneAsync(wrappedKeyDocument, cancellationToken: cancellationToken).ConfigureAwait(false);
@@ -555,7 +555,7 @@ private byte[] GetWrappedValueBytes(BsonValue value)
555555

556556
private static BsonValue RenderFilter(FilterDefinition<BsonDocument> filter)
557557
{
558-
var registry = BsonSerializer.SerializerRegistry; //FP I think this is fine, as it should be default configuration.
558+
var registry = BsonSerializer.SerializerRegistry; //FP I think this is fine for now, this should use the standard domain.
559559
var serializer = registry.GetSerializer<BsonDocument>();
560560
return filter.Render(new(serializer, registry));
561561
}
@@ -572,7 +572,7 @@ private static Guid UnwrapKeyId(BsonDocument wrappedKeyDocument)
572572

573573
private static BsonValue UnwrapValue(byte[] encryptedWrappedBytes)
574574
{
575-
var bsonDocument = BsonSerializer.Deserialize<BsonDocument>(encryptedWrappedBytes); //FP I think this is fine, as it should be default configuration.
575+
var bsonDocument = BsonSerializer.Deserialize<BsonDocument>(encryptedWrappedBytes); //FP I think this is fine for now, this should use the standard domain.
576576
return bsonDocument["v"];
577577
}
578578
}

src/MongoDB.Driver/Core/Bindings/CoreSession.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public sealed class CoreSession : ICoreSession, ICoreSessionInternal
4646
private BsonTimestamp _snapshotTime;
4747

4848
// constructors
49-
//FP This constructor is only used by the tests.
5049
internal CoreSession(
5150
IClusterInternal cluster,
5251
ICoreServerSession serverSession,

src/MongoDB.Driver/Core/WireProtocol/Messages/Encoders/BinaryEncoders/CommandMessageBinaryEncoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal sealed class CommandMessageBinaryEncoder : MessageBinaryEncoderBase, IM
2929
{
3030
private const int EncryptedMaxBatchSize = 2 * 1024 * 1024; // 2 MiB
3131
private static readonly ICommandMessageSectionFormatter<Type0CommandMessageSection> __type0SectionFormatter = new Type0SectionFormatter(BsonSerializer.DefaultSerializationDomain);
32-
//QUESTION Looking at the spec and our implementation, it seems that type 0 sections always serialize/deserialize RawBsonDocument, so they should use the default domain. Am I missing something?
32+
//QUESTION Looking at the spec and our implementation, it seems that type 0 sections always serialize/deserialize RawBsonDocument, so they should use the standard domain. Am I missing something?
3333

3434
// constructors
3535
public CommandMessageBinaryEncoder(Stream stream, MessageEncoderSettings encoderSettings)

src/MongoDB.Driver/GeoJsonObjectModel/Serializers/GeoJsonBoundingBoxSerializer.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,12 @@ protected override GeoJsonBoundingBox<TCoordinates> DeserializeValue(BsonDeseria
9393
/// <param name="value">The value.</param>
9494
protected override void SerializeValue(BsonSerializationContext context, BsonSerializationArgs args, GeoJsonBoundingBox<TCoordinates> value)
9595
{
96-
var bsonWriter = context.Writer;
97-
9896
// serialize min and max to a dummy document and then flatten the two arrays and serialize that
9997
var document = new BsonDocument();
10098
using (var documentWriter = new BsonDocumentWriter(document))
10199
{
102100
var documentContext =
103-
BsonSerializationContext.CreateRoot(documentWriter, BsonSerializer.DefaultSerializationDomain); //FP Is this correct?;
101+
BsonSerializationContext.CreateRoot(documentWriter, context.SerializationDomain);
104102
documentWriter.WriteStartDocument();
105103
documentWriter.WriteName("min");
106104
_coordinatesSerializer.Serialize(documentContext, value.Min);

0 commit comments

Comments
 (0)