RemoteMongoReadOperation
public class RemoteMongoReadOperation<T> where T : Decodable, T : Encodable
RemoteMongoReadOperation represents a find or aggregate operation
on a RemoteMongoCollection.
The methods in this class execute the operation and retrieve the results.
See also
RemoteMongoCollection
-
Executes the operation and returns the first document in the result.
Declaration
Swift
public func first(_ completionHandler: @escaping (StitchResult<T?>) -> Void)Parameters
completionHandlerThe completion handler to call when the operation is completed or if the operation fails. This handler is executed on a non-main global
DispatchQueue. If the operation is successful, the result will contain an optionalTindicating the first document in the result. the document will benilif the result was empty. -
Executes the operation and returns the result as an array.
Declaration
Swift
public func toArray(_ completionHandler: @escaping (StitchResult<[T]>) -> Void)Parameters
completionHandlerThe completion handler to call when the operation is completed or if the operation fails. This handler is executed on a non-main global
DispatchQueue. If the operation is successful, the result will contain the documents in the result as an array. -
Executes the operation and returns the result as an array. Deprecated in favor of
toArray(completionHandler:).Declaration
Swift
@available(*, deprecated, message: "use toArray instead") public func asArray(_ completionHandler: @escaping (StitchResult<[T]>) -> Void)Parameters
completionHandlerThe completion handler to call when the operation is completed or if the operation fails. This handler is executed on a non-main global
DispatchQueue. If the operation is successful, the result will contain the documents in the result as an array. -
Executes the operation and returns a
RemoteMongoCursorto its resulting documents.Declaration
Swift
public func iterator(_ completionHandler: @escaping (StitchResult<RemoteMongoCursor<T>>) -> Void)Parameters
completionHandlerThe completion handler to call when the operation is completed or if the operation fails. This handler is executed on a non-main global
DispatchQueue. If the operation is successful, the result will contain an asynchronously iterating cursor to the documents in the result.
RemoteMongoReadOperation Class Reference