MONGODB_ERROR(realm::app::ServiceError:12): (AtlasError) $ifNull is not allowed or the syntax is incorrect, see the Atlas documentation for more information

Hello community,

I have made a function wich works well in Atlas App Services but after integrated in my android app using the same method from https://www.mongodb.com/docs/realm/sdk/java/examples/call-a-function/#std-label-java-call-a-function (that works pretty well with other of my functions), I have got that error:

E/EXAMPLE: failed to call function with: MONGODB_ERROR(realm::app::ServiceError:12): (AtlasError) $ifNull is not allowed or the syntax is incorrect, see the Atlas documentation for more information

In that function, I don’t use $cond or $ifnull statement inside find query or aggregation pipeline. I only use if/else statement from javascript language outside my querys, because I need to teste some arguments before doing my querys.

I use a simple Atlas M0 free cluster and i didn’t find any limitations from Atlas M0 (Free Cluster), M2, and M5 Limitations — MongoDB Atlas.

Could someone help me with that issue?

Damien.

I have found the error which was from the fact that I didn’t deploy my function. So basically, I used my old functions in the app, note the last one which was in draft mode. I also managed some other errors.