Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSHARP-5442: Atlas Search doesn't respect the correct serializer #1583

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b777fae
Initial
papafe Dec 31, 2024
86ee6cf
Various corrections
papafe Dec 31, 2024
9c7c4a4
Corrections
papafe Dec 31, 2024
b616cbc
Small fix
papafe Dec 31, 2024
d7db9a0
Removed extra spaces
papafe Dec 31, 2024
c7d2881
Small corrections
papafe Dec 31, 2024
c19972d
Added tests and fixed
papafe Jan 2, 2025
250e5be
Missing statment
papafe Jan 2, 2025
d210cd8
Various corrections
papafe Jan 2, 2025
a9f63a8
Corrections
papafe Jan 2, 2025
ed6afcd
Small fix
papafe Jan 2, 2025
b189ee4
Small correction
papafe Jan 2, 2025
8fb8979
Moved testing to main file
papafe Jan 6, 2025
de751e4
Corrected operator
papafe Jan 6, 2025
73fbd04
Added missing parenthesis
papafe Jan 6, 2025
5177c59
Removed unsupported test
papafe Jan 6, 2025
8e53214
Added support for In
papafe Jan 6, 2025
ca05584
Added support for range
papafe Jan 6, 2025
f402b0e
Corrected tests
papafe Jan 7, 2025
b67443a
Small corrections
papafe Jan 7, 2025
0cae022
Small correction to tests
papafe Jan 7, 2025
c672881
Test correction
papafe Jan 7, 2025
8796216
Remove comment
papafe Jan 8, 2025
a8571e5
Moved method
papafe Jan 8, 2025
640abef
Name corrections
papafe Jan 8, 2025
ed54bae
Fixes according to PR
papafe Feb 5, 2025
b19e5e6
Small fixes
papafe Feb 5, 2025
53bb632
Corrected TField to TValue for better clarity
papafe Feb 5, 2025
d84f290
Small fix
papafe Feb 5, 2025
993832b
Correction to avoid path rendering twice
papafe Feb 6, 2025
a99e785
Small fix
papafe Feb 6, 2025
4afcaef
Small fix
papafe Feb 6, 2025
166edbf
Fixes according to PR
papafe Feb 6, 2025
eb4cb3f
Improvement
papafe Feb 6, 2025
82e2675
Small corrections according to PR
papafe Feb 7, 2025
1f29e6a
Fixed indentation
papafe Feb 11, 2025
484fa7e
Corrections according to PR
papafe Feb 11, 2025
2450326
Naming correction
papafe Feb 11, 2025
6e2d349
Added extension method to support old and new behaviour
papafe Feb 11, 2025
eaa16c4
Small correction again
papafe Feb 27, 2025
8522ef3
Corrected serializer
papafe Feb 27, 2025
44a8aa8
Name correction
papafe Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/MongoDB.Driver/FieldValueSerializerHelper.cs
Original file line number Diff line number Diff line change
@@ -141,18 +141,6 @@ public static IBsonSerializer GetSerializerForValueType(IBsonSerializer fieldSer
return ConvertIfPossibleSerializer.Create(valueType, fieldType, fieldSerializer, serializerRegistry);
}

public static IBsonSerializer GetSerializerForValueType(IBsonSerializer fieldSerializer, IBsonSerializerRegistry serializerRegistry, Type valueType, object value)
{
if (!valueType.GetTypeInfo().IsValueType && value == null)
{
return fieldSerializer;
}
else
{
return GetSerializerForValueType(fieldSerializer, serializerRegistry, valueType, allowScalarValueForArrayField: false);
}
}

// private static methods
private static bool HasStringRepresentation(IBsonSerializer serializer)
{
@@ -313,7 +301,7 @@ public override void Serialize(BsonSerializationContext context, BsonSerializati
}
}

internal class IEnumerableSerializer<TItem> : SerializerBase<IEnumerable<TItem>>
internal class IEnumerableSerializer<TItem> : SerializerBase<IEnumerable<TItem>>, IBsonArraySerializer
{
private readonly IBsonSerializer<TItem> _itemSerializer;

@@ -351,6 +339,12 @@ public override void Serialize(BsonSerializationContext context, BsonSerializati
bsonWriter.WriteEndArray();
}
}

public bool TryGetItemSerializationInfo(out BsonSerializationInfo serializationInfo)
{
serializationInfo = new BsonSerializationInfo(null, _itemSerializer, typeof(TItem));
return true;
}
}

internal class NullableEnumConvertingSerializer<TFrom, TTo> : SerializerBase<Nullable<TFrom>> where TFrom : struct where TTo : struct
1 change: 0 additions & 1 deletion src/MongoDB.Driver/IAggregateFluent.cs
Original file line number Diff line number Diff line change
@@ -404,7 +404,6 @@ IAggregateFluent<TNewResult> Lookup<TForeignDocument, TAsElement, TAs, TNewResul
IAggregateFluent<BsonDocument> SetWindowFields<TWindowFields>(
AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields> output);

//TODO If I add a parameter here, then this would be a binary breaking change
/// <summary>
/// Appends a $search stage to the pipeline.
/// </summary>
Loading
Oops, something went wrong.