Instance Methodmongokitten 7.9.5MongoClient
executeOpQuery(_:in:sessionId:logMetadata:traceLabel:serviceContext:)
Executes a command on the server and returns the reply, or throws an error if the command failed. This method is used for executing commands that are not encoded as BSON documents. Always uses OP_QUERY.
Connection+Execute.swift:125func executeOpQuery(_ query: inout OpQuery, in transaction: MongoTransaction? = nil, sessionId: SessionIdentifier? = nil, logMetadata: Logger.Metadata? = nil, traceLabel: String = "executeCommand", serviceContext context: ServiceContext? = nil) async throws -> OpReply
Parameters
- command
The command to execute on the server. Updated with the next request id.
- namespace
The namespace to execute the command in. Defaults to the administrative command namespace.
- transaction
The transaction to execute the command in.
Other members in extension
Type members
init(channel: Channel, context: MongoClientContext, sessionManager: MongoSessionManager
) Creates a connection that can communicate with MongoDB over a channel
static func addHandlers(to: Channel, context: MongoClientContext
) -> EventLoopFuture<Void> Registers MongoKitten’s handlers on the channel
static func connect(settings: ConnectionSettings, logger: Logger, resolver: Resolver?, clientDetails: MongoClientDetails?
) async throws -> MongoConnection Connects to a MongoDB server using the given settings.
Instance members
var allocator: ByteBufferAllocator
nonisolated var closeFuture: EventLoopFuture<Void>
nonisolated var eventLoop: EventLoop
nonisolated var implicitSession: MongoClientSession
The implicit session, used for operations that don’t require a session
nonisolated var implicitSessionId: SessionIdentifier
The implicit session ID, used for operations that don’t require a session
var isMetricsEnabled: Bool
Whether metrics are enabled. When enabled, metrics will be collected for queries using the
Metrics
library.var lastHeartbeat: MongoHandshakeResult?
The last heartbeat result received
nonisolated var logger: Logger
var queryTimeout: TimeAmount?
The timeout for queries, defaults to 30 seconds
var serverHandshake: ServerHandshake?
The handshake received from the server
let sessionManager: MongoSessionManager
A LIFO (Last In, First Out) holder for sessions
let slaveOk: ManagedAtomic<Bool>
Whether this connection is a slaveOk connection, meaning it can read from secondaries
var wireVersion: WireVersion?
func authenticate(clientDetails: MongoClientDetails?, using: ConnectionSettings.Authentication, to: String
) async throws func close(
) async Close the connection to the MongoDB server
func doHandshake(clientDetails: MongoClientDetails?, credentials: ConnectionSettings.Authentication, authenticationDatabase: String
) async throws -> ServerHandshake Executes a MongoDB
isMaster
func execute(Document, namespace: MongoNamespace, in: MongoTransaction?, sessionId: SessionIdentifier?, logMetadata: Logger.Metadata?, traceLabel: String, serviceContext: ServiceContext?
) async throws -> MongoServerReply Executes a command on the server and returns the reply, or throws an error if the command failed.
func executeCodable<E, D>(E, decodeAs: D.Type, namespace: MongoNamespace, in: MongoTransaction?, sessionId: SessionIdentifier?, logMetadata: Logger.Metadata?, traceLabel: String, serviceContext: ServiceContext?
) async throws -> D Executes a command on the server and returns the reply, or throws an error if the command failed. Uses a different protocol depending on the connection.
func executeEncodable<E>(E, namespace: MongoNamespace, in: MongoTransaction?, sessionId: SessionIdentifier?, logMetadata: Logger.Metadata?, traceLabel: String, serviceContext: ServiceContext?
) async throws -> MongoServerReply Executes a command on the server and returns the reply, or throws an error if the command failed. Uses a different protocol depending on the connection.
func executeOpMessage(inout OpMessage, in: MongoTransaction?, sessionId: SessionIdentifier?, logMetadata: Logger.Metadata?, traceLabel: String, serviceContext: ServiceContext?
) async throws -> OpMessage Executes a command on the server and returns the reply, or throws an error if the command failed. This method is used for executing commands that are not encoded as BSON documents. Always uses OP_MSG.
func next(for: ConnectionPoolRequest
) async throws -> MongoConnection func ping(
) async throws