public struct Functions

Structure providing an interface to call a MongoDB Realm function with the provided name and arguments.

user.functions.sum([1, 2, 3, 4, 5]) { sum, error in
    guard case let .int64(value) = sum else {

    assert(value == 15)

The dynamic member name (sum in the above example) is directly associated with the function name. The first argument is the BSONArray of arguments to be provided to the function. The second and final argument is the completion handler to call when the function call is complete. This handler is executed on a non-main global DispatchQueue.