[CSHARP-1348] Manual constructed expressions problem Created: 16/Jul/15 Updated: 17/Jul/15 Resolved: 17/Jul/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Slapman | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
I have a simple "Event" class with a DateTime "Time" property. If I create an index using the following code
everything works fine. Then, I constructed expression by hand:
it worked again. Then I ported the code to F# (it was my original goal):
And it ended with "System.InvalidOperationException: Unable to determine the serialization information for arg => Convert(arg.Time)." The question is why? Expression are just identical. |
| Comments |
| Comment by Craig Wilson [ 17/Jul/15 ] | ||||||
|
Thanks Daniel. I'll close the ticket. Yes, we have plans to make the F# driver a reality. It's just about finding the time amidst all our other priorities. Craig | ||||||
| Comment by Daniel Slapman [ 16/Jul/15 ] | ||||||
|
I just built Max Hirschhorn's serializers from mongo-fsharp-driver-prototype, the problem disappeared. By the way, are there any plans to continue work on official F# driver? | ||||||
| Comment by Daniel Slapman [ 16/Jul/15 ] | ||||||
|
I'd attached the solution, hope it will help. | ||||||
| Comment by Daniel Slapman [ 16/Jul/15 ] | ||||||
|
My main goal is to avoid "magic strings". | ||||||
| Comment by Daniel Slapman [ 16/Jul/15 ] | ||||||
|
Hi Craig, | ||||||
| Comment by Craig Wilson [ 16/Jul/15 ] | ||||||
|
Just to note... using a string instead of the expression tree will garner you the same results. When we have a typed collection, we'll attempt to match a string up to a property or field and do the translation correctly if, for instance, the property was mapped to a different field name. So, if you are using reflection to get the property name, just use the property's name and it should be handled.
| ||||||
| Comment by Craig Wilson [ 16/Jul/15 ] | ||||||
|
Hi Daniel, Thanks for the report. I'll have to look into it. We don't currently have any tests in F# so there is a good likelihood that some things won't work. Craig |