Summary
doing a linq query on datetime.year results in an exception :Serializer for System.DateTime must implement IBsonDocumentSerializer to be used with LINQ.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
How to Reproduce
example:
var interactions = await (await EquipmentInteractionsCollection.AsQueryable()
.Where(b => b.MemberId == memberId &&
(b != null && b.InteractionDate.HasValue && b.InteractionDate.Value.Date >= startDateTime.Date)).ToCursorAsync()).ToListAsync();
Additional Background
I think this issue was brought in story CSHARP-4415 and was addressed, but it seems it's not completely fixed
- backported by
-
CSHARP-4415 DateTime.Year throws an exception for IQueryable<DateTime>
- Closed
- backports
-
CSHARP-4772 Add support for List<T>.Exists and Array.Exists<T> in LINQ3
- Closed
-
CSHARP-4773 Linq3Implementation: MongoDB.Driver.Linq.ExpressionNotSupportedException : Exists
- Closed