How to define function in mongocxx

Hello, I want to write a function instead of aggregation. How can I do this in mongocxx?

Here ( is a function writing with aggregation, how can I write another function instead?

I’ve been searching for a long time, but I couldn’t find an example that says function with cxx.

Hi @sylvester,

If you’re asking whether you can write a function in C++ instead of JavaScript, unfortunately currently (MongoDB version 4.4) the only supported language is JavaScript.

What kind of operations were you trying to perform using $function ? If it’s possible I would recommend to try using MongoDB Aggregation Pipeline.