Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2463

$facet is not deserializing

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None

      I'm trying to run this command:

      var applicationsPipeline = PipelineDefinition<AffiliateRecord, List<ApplicationRecord>>.Create(new IPipelineStageDefinition[] {
          PipelineStageDefinitionBuilder.Match<AffiliateRecord>(filter),
          PipelineStageDefinitionBuilder.Unwind<AffiliateRecord, AffiliateRecord>("Applications"),
          PipelineStageDefinitionBuilder.Match<AffiliateRecord>(matchApplications),
          PipelineStageDefinitionBuilder.ReplaceRoot<AffiliateRecord, List<ApplicationRecord>>(x => x.Applications),
          PipelineStageDefinitionBuilder.Skip<List<ApplicationRecord>>(offset),
          PipelineStageDefinitionBuilder.Limit<List<ApplicationRecord>>(limit),
      });
      
      var applicationsFacet = AggregateFacet.Create("applications", applicationsPipeline);
      
      var aggregate = collection
          .Aggregate()
          .Facet(applicationsFacet, ...);
      
      var facetResult = await aggregate.SingleOrDefaultAsync();
      

      but I'm getting this error:

      System.FormatException: Cannot deserialize a 'List<ApplicationRecord>' from BsonType 'Document'.
      

      What am I missing?

            Assignee:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Reporter:
            murilokunze Murilo Kunze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: