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"]}}}
              }
           }
eddieO
  • 84
  • 1
  • 7
  • 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. – Neil Lunn Sep 21 '19 at 02:46
  • You might also see [Aggregate $lookup with C#](https://stackoverflow.com/a/50540059/2313887) and/or [MongoDB .NET Driver Group By Time Range](https://stackoverflow.com/a/50552288/2313887) for examples in usage of the Fluent interface as well as LINQ alternatives – Neil Lunn Sep 21 '19 at 02:49

0 Answers0