call
Invokes an Atlas function.
Since the serialization engine does not support third-party libraries yet, there are some limitations in what types can be used as arguments and return types:
Primitives, Bson, MutableRealmInt, RealmUUID, ObjectId, RealmInstant, RealmAny, Array, Collection, and Map are valid argument types.
Results can only be deserialized to Bson, MutableRealmInt, RealmUUID, ObjectId, RealmInstant, RealmAny and primitive types
The Bson implementations for arrays or maps are BsonArray and BsonDocument, and they can be used as valid return types.
Return
result of the function call.
Parameters
name of the function to call.
arguments to the function.
the function return value type.
Throws
if the function failed in some way.
for other failures that can happen when communicating with App Services. See AppException for details.
Invokes an Atlas function using the EJson encoder defined in AppConfiguration.ejson.
Note This method supports full document serialization. The call arguments are defined with the builder CallBuilder. This same builder also allows to bind manually any argument or the return type to a specific serializer. Arguments and the return value will be encoded and decoded with AppConfiguration.ejson.
val dog: Dog = user.functions.call("RetrieveDog") {
add("a parameter")
add(1.5, FloatSerializer) // sets the serializer for this particular argument
returnValueSerializer = DogSerializer // sets the serializer for the return type
}
We cannot use a generic because:
There is no serializer available for Any.
Return
result of the function call.
Parameters
name of the function to call.
code block that sets the call arguments and serializers.
the function return value type.