[CSHARP-2463] $facet is not deserializing Created: 24/Dec/18 Updated: 27/Oct/23 Resolved: 30/Jan/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial - P5 |
| Reporter: | Murilo Kunze | Assignee: | Wan Bachtiar |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
I'm trying to run this command:
but I'm getting this error:
What am I missing? |
| Comments |
| Comment by Wan Bachtiar [ 18/Jan/19 ] | ||||||||||||
Hi Murilo, I think you meant the other way around (also based on your own snippet). You need to specify TOutput as ApplicationRecord instead of List<ApplicationRecord>. This is not a bug in the driver, but an expected behaviour. The $unwind stage outputs a single `ApplicationRecord` and not an array anymore. For example, from:
to:
The $replaceRoot stage then only promotes the singular `ApplicationRecord` to root. i.e. {{ {record:1}}}. The deserialise error is also the result of the mismatched type of List<ApplicationRecord>. Regards, | ||||||||||||
| Comment by Murilo Kunze [ 26/Dec/18 ] | ||||||||||||
|
I was able to make it work like this:
which makes me think that ReplaceRoot has some kind of bug because it forces me to set TOutput as List<ApplicationRecord> instead of ApplicationRecord. |