.NET Driver - Aggregation Update Builder?

Hello,

I’m trying to use the aggregation update feature introduced in 4.2, however I’m having a difficult time writing code that is readable using the available methods.

The aggregation update I’m trying to write isn’t remotely complex, the most complex part is performing a cond with a LTE as the condition but even so I end up with a horrendously nested BsonDocument tree…

Using raw strings in place of BsonDocuments would help some what, but since I need to interpolate values into the query the character escaping leads to almost equally bad code.

Perhaps I’m missing a trick here but are these really the only options I have, if so are there plans to add a builder for aggregation updates? It really makes doing anything just slightly more complex than CRUD operations very tedious.

Thanks.

Hi, @Sam_na1, could you provide a sample document and the typical scenarios and it will be helpful to answer your needs.

1 Like