Command
A type that represents a MongoDB command. All public command types (and command protocols) ultimately inherit from this protocol.
protocol Command<Response> : SendableBrowse conforming typesA type that represents a MongoDB command. All public command types (and command protocols) ultimately inherit from this protocol.
protocol Command<Response> : Sendableimport MongoA single-type module that declares the Mongo namespace.
import MongoCommandsenum Mongoassociatedtype Response : SendableThe server response this command expects to receive.
protocol Sendableassociatedtype Database : Mongo.DatabaseType = Mongo.DatabaseThe type of database this command can be run against.
associatedtype ExecutionPolicy = Mongo.Onceassociatedtype ReadConcern = Neverassociatedtype WriteConcern = Neverstatic var type: CommandType { get }The official name of this command, in the MongoDB specification. It always begins with a lowercase letter, and usually resembles the name of the command type.
static func decode(reply: BSON.DocumentDecoder<BSON.Key>) throws -> Response var fields: BSON.Document { get }The opaque fields of this command. Not all conforming types will encode all of their fields to this property; some may have fields (such as readConcern or maxTimeMS) that are recognized by the driver and added later during the command execution process.
var outline: OutlineVector? { get }The payload of this command.
var readConcern: Self.ReadConcern? { get }var readConcernLabel: Mongo.ReadConcern?? { get }var timeout: MaxTime { get }var writeConcern: Self.WriteConcern? { get }var writeConcernLabel: Mongo.WriteConcern? { get }protocol DatabaseTypeThe type of database a Mongo.Command can be run against.
enum CommandType@frozen struct CursorBatch<Element> where Element : BSONDecodable, Element : Sendable@frozen struct CursorIdentifierA cursor handle that is guaranteed to be non-null.
@frozen enum MaxTime@frozen enum Once@frozen enum ReadConcernThe amount of ratification data needs to have received before it can be returned by a read command.
@frozen enum Retry@frozen struct Tailing@frozen struct WriteConcernstruct WriteConcernError@frozen enum WriteConcernProvenancevar outline: Mongo.OutlineVector? { get }Returns nil.
var timeout: Mongo.MaxTime { get }Returns computed.
var readConcernLabel: Mongo.ReadConcern?? { get }@frozen enum NeverA type that has no values and can’t be constructed.
var readConcern: Never? { get }var readConcernLabel: Mongo.ReadConcern?? { get }protocol BSONDocumentDecodable<CodingKey> : BSONDecodableA type that can be decoded from a BSON dictionary-decoder.
@frozen struct KeyA BSON field key. This type wraps a rawValue that is guaranteed to never contain null bytes. (Null bytes in a BSON field key can be exploited to perform SQL injection.)
static func decode(reply: BSON.DocumentDecoder<BSON.Key>) throws -> Response Delegates to the Response type’s BSONDocumentDecodable conformance.
static func decode(reply _: BSON.DocumentDecoder<BSON.Key>) Does nothing, ignoring the supplied decoding container.
var writeConcernLabel: Mongo.WriteConcern? { get }var writeConcern: Never? { get }var writeConcernLabel: Mongo.WriteConcern? { get }import MongoDriverstatic var autocommits: Bool { get }Indicates if this command autocommits, meaning it supports retryable writes.
protocol ImplicitSessionCommand<Response> : Mongo.CommandA type that can encode a MongoDB command that can be run as part of a session, which can be implicitly generated if the command is sent to a deployment at large.
protocol IterableCommand<Element> : Mongo.Commandprotocol TransactableCommand<Response> : Mongo.Command