How to create a custom udaf in mongo db?

HI,

i want to create create a custom user defined aggregation function in mongo db how to do it??

Hi @anubhav_tarar,

Welcome to MongoDB community.

I think you are looking for $function or $accumulator:

https://docs.mongodb.com/manual/reference/operator/aggregation/function/

https://docs.mongodb.com/manual/reference/operator/aggregation/accumulator/

Those are available from 4.4 .

Otherwise there is a mapReduce command
https://docs.mongodb.com/manual/reference/command/mapReduce/index.html

Thanks
Pavel

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.