0

Basically I need to use $arrayToObject but I don't see how I can use it with LINQ. Is there a way to create a LINQ query using mongo driver that would generate above aggregation step?

This is the example aggregation pipeline step:

           {
             $project: {
              tmp:{$arrayToObject:
                  {$zip:{inputs: 
                          ["$items.TypeCode","$items.Value"]}}}
              }
           }
2
  • 1
    No there is no "direct" LINQ equivalent for those operations. You would want the fluent interface instead. BsonDocument and BsonArray are your constructors for representing the {} and [] parts respectively. Commented Sep 21, 2019 at 2:46
  • You might also see Aggregate $lookup with C# and/or MongoDB .NET Driver Group By Time Range for examples in usage of the Fluent interface as well as LINQ alternatives Commented Sep 21, 2019 at 2:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.