Selection of EJSON or JSON function return type

The option to select if a function returns EJSON or JSON was removed. WHY?

Hi @michael_schiller,

The option to return EJSON or JSON has never been part of the Function itself (a Function, per se, can return any kind of result, including complex objects), but rather of the HTTPS Endpoints Settings, and it’s still available. Can you please elaborate on what are you seeing?

Yes you are correct, my bad.
But it would have been nice if this option was available at the function level.

Hi @michael_schiller,

Glad we could help!

As explained above, a Function can be called in several environments (including Triggers, Authentication, other Functions, etc.), not just HTTPS Endpoints, so keeping them able to return everything is a requirement. OTOH, HTTPS Responses are limited in what they can contain, so conversion to JSON or EJSON is necessary.

The option to select if a function returns EJSON or JSON was removed. WHY?

The option to choose between EJSON and JSON for function returns was likely removed to simplify the API and avoid confusion. EJSON extends JSON with more data types, so the system might now default to EJSON to handle a broader range of data without needing separate options.