- 
                  
                  Encoder used by this database for BSON conversions. This encoder’s options are inherited by collections derived from this database. DeclarationSwift public let encoder: BSONEncoder
- 
                  
                  Decoder whose options are inherited by collections derived from this database. DeclarationSwift public let decoder: BSONDecoder
- 
                  
                  The name of this database. DeclarationSwift public var name: String { get }
- 
                  
                  The ReadConcernset on this database, ornilif one is not set.DeclarationSwift public let readConcern: ReadConcern?
- 
                  
                  The ReadPreferenceset on this databaseDeclarationSwift public let readPreference: ReadPreference
- 
                  
                  The WriteConcernset on this database, ornilif one is not set.DeclarationSwift public let writeConcern: WriteConcern?
- 
                  
                  Drops this database. DeclarationSwift public func drop(options: DropDatabaseOptions? = nil, session: ClientSession? = nil) -> EventLoopFuture<Void>Return ValueAn EventLoopFuture<Void>that succeeds when the drop is successful.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs that prevents the command from executing.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this database’s parent client has already been closed.
 
- 
                  
                  Access a collection within this database. If an option is not specified in the MongoCollectionOptionsparam, the collection will inherit the value from the parent database or the default if the db’s option is not set. To override an option inherited from the db (e.g. a read concern) with the default value, it must be explicitly specified in the options param (e.g. ReadConcern.serverDefault, not nil).DeclarationSwift public func collection(_ name: String, options: MongoCollectionOptions? = nil) -> MongoCollection<BSONDocument>Parametersnamethe name of the collection to get optionsoptions to set on the returned collection Return Valuethe requested MongoCollection<Document>
- 
                  
                  Access a collection within this database, and associates the specified CodabletypeTwith the returnedMongoCollection. This association only exists in the context of this particularMongoCollectioninstance. If an option is not specified in theMongoCollectionOptionsparam, the collection will inherit the value from the parent database or the default if the db’s option is not set. To override an option inherited from the db (e.g. a read concern) with the default value, it must be explicitly specified in the options param (e.g. ReadConcern.serverDefault, not nil).DeclarationSwift public func collection<T: Codable>( _ name: String, withType _: T.Type, options: MongoCollectionOptions? = nil ) -> MongoCollection<T>Parametersnamethe name of the collection to get optionsoptions to set on the returned collection Return Valuethe requested MongoCollection<T>
- 
                  
                  Creates a collection in this database with the specified options. DeclarationSwift public func createCollection( _ name: String, options: CreateCollectionOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<MongoCollection<BSONDocument>>Parametersnamea String, the name of the collection to createoptionsOptional CreateCollectionOptionsto use for the collectionsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<MongoCollection<Document>>. On success, contains the newly created collection.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs that prevents the command from executing.
- MongoError.InvalidArgumentErrorif the options passed in form an invalid combination.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
- EncodingErrorif an error occurs while encoding the options to BSON.
 
- 
                  
                  Creates a collection in this database with the specified options, and associates the specified CodabletypeTwith the returnedMongoCollection. This association only exists in the context of this particularMongoCollectioninstance.DeclarationSwift public func createCollection<T: Codable>( _ name: String, withType type: T.Type, options: CreateCollectionOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<MongoCollection<T>>Parametersnamea String, the name of the collection to createoptionsOptional CreateCollectionOptionsto use for the collectionsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<MongoCollection<T>>. On success, contains the newly created collection.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs that prevents the command from executing.
- MongoError.InvalidArgumentErrorif the options passed in form an invalid combination.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
- EncodingErrorif an error occurs while encoding the options to BSON.
 
- 
                  
                  Lists all the collections in this database. Warning If the returned cursor is alive when it goes out of scope, it will leak resources. To ensure the cursor is dead before it leaves scope, invoke MongoCursor.kill(...)on it.DeclarationSwift public func listCollections( _ filter: BSONDocument? = nil, options: ListCollectionsOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<MongoCursor<CollectionSpecification>>Parametersfiltera BSONDocument, optional criteria to filter results byoptionsOptional ListCollectionsOptionsto use when executing this commandsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<MongoCursor<CollectionSpecification>>containing a cursor over the collections.If the future fails, the error is likely one of the following: - MongoError.InvalidArgumentErrorif the options passed are an invalid combination.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
 
- 
                  
                  Gets a list of MongoCollections corresponding to collections in this database.DeclarationSwift public func listMongoCollections( _ filter: BSONDocument? = nil, options: ListCollectionsOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<[MongoCollection<BSONDocument>]>Parametersfiltera BSONDocument, optional criteria to filter results byoptionsOptional ListCollectionsOptionsto use when executing this commandsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<[MongoCollection<Document>]>. On success, contains collections that match the provided filter.If the future fails, the error is likely one of the following: - MongoError.InvalidArgumentErrorif the options passed are an invalid combination.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
 
- 
                  
                  Gets a list of names of collections in this database. DeclarationSwift public func listCollectionNames( _ filter: BSONDocument? = nil, options: ListCollectionsOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<[String]>Parametersfiltera BSONDocument, optional criteria to filter results byoptionsOptional ListCollectionsOptionsto use when executing this commandsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<[String]>. On success, contains names of collections that match the provided filter.If the future fails, the error is likely one of the following: - MongoError.InvalidArgumentErrorif the options passed are an invalid combination.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
 
- 
                  
                  Issues a MongoDB command against this database. DeclarationSwift public func runCommand( _ command: BSONDocument, options: RunCommandOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<BSONDocument>Parameterscommanda BSONDocumentcontaining the command to issue against the databaseoptionsOptional RunCommandOptionsto use when executing this commandsessionOptional ClientSessionto use when executing this commandReturn ValueAn EventLoopFuture<Document>. On success, contains the server response to the command.If the future fails, the error is likely one of the following: - MongoError.InvalidArgumentErrorif- requestsis empty.
- MongoError.LogicErrorif the provided session is inactive.
- MongoError.LogicErrorif this databases’s parent client has already been closed.
- MongoError.WriteErrorif any error occurs while the command was performing a write.
- MongoError.CommandErrorif an error occurs that prevents the command from being performed.
- EncodingErrorif an error occurs while encoding the options to BSON.
 
- 
                  
                  Starts a ChangeStreamon a database. Excludes system collections.Warning If the returned change stream is alive when it goes out of scope, it will leak resources. To ensure the change stream is dead before it leaves scope, invoke ChangeStream.kill(...)on it.See also SeeAlso: Note Supported in MongoDB version 4.0+ only. DeclarationSwift public func watch( _ pipeline: [BSONDocument] = [], options: ChangeStreamOptions? = nil, session: ClientSession? = nil ) -> EventLoopFuture<ChangeStream<ChangeStreamEvent<BSONDocument>>>ParameterspipelineAn array of aggregation pipeline stages to apply to the events returned by the change stream. optionsAn optional ChangeStreamOptionsto use when constructing the change stream.sessionAn optional ClientSessionto use with this change stream.Return ValueAn EventLoopFuture<ChangeStream>. On success, contains aChangeStreamwatching all collections in this database.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs on the server while creating the change stream.
- MongoError.InvalidArgumentErrorif the options passed formed an invalid combination.
- MongoError.InvalidArgumentErrorif the- _idfield is projected out of the change stream documents by the pipeline.
 
- 
                  
                  Starts a ChangeStreamon a database. Excludes system collections. Associates the specifiedCodabletypeTwith thefullDocumentfield in theChangeStreamEvents emitted by the returnedChangeStream.Warning If the returned change stream is alive when it goes out of scope, it will leak resources. To ensure the change stream is dead before it leaves scope, invoke ChangeStream.kill(...)on it.See also SeeAlso: Note Supported in MongoDB version 4.0+ only. DeclarationSwift public func watch<FullDocType: Codable>( _ pipeline: [BSONDocument] = [], options: ChangeStreamOptions? = nil, session: ClientSession? = nil, withFullDocumentType _: FullDocType.Type ) -> EventLoopFuture<ChangeStream<ChangeStreamEvent<FullDocType>>>ParameterspipelineAn array of aggregation pipeline stages to apply to the events returned by the change stream. optionsAn optional ChangeStreamOptionsto use when constructing the change stream.sessionAn optional ClientSessionto use with this change stream.withFullDocumentTypeThe type that the fullDocumentfield of the emittedChangeStreamEvents will be decoded to.Return ValueAn EventLoopFuture<ChangeStream>. On success, contains aChangeStreamwatching all collections in this database.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs on the server while creating the change stream.
- MongoError.InvalidArgumentErrorif the options passed formed an invalid combination.
- MongoError.InvalidArgumentErrorif the- _idfield is projected out of the change stream documents by the pipeline.
 
- 
                  
                  Starts a ChangeStreamon a database. Excludes system collections. Associates the specifiedCodabletypeTwith the returnedChangeStream.Warning If the returned change stream is alive when it goes out of scope, it will leak resources. To ensure the change stream is dead before it leaves scope, invoke ChangeStream.kill(...)on it.See also SeeAlso: Note Supported in MongoDB version 4.0+ only. DeclarationSwift public func watch<EventType: Codable>( _ pipeline: [BSONDocument] = [], options: ChangeStreamOptions? = nil, session: ClientSession? = nil, withEventType _: EventType.Type ) -> EventLoopFuture<ChangeStream<EventType>>ParameterspipelineAn array of aggregation pipeline stages to apply to the events returned by the change stream. optionsAn optional ChangeStreamOptionsto use when constructing theChangeStream.sessionAn optional ClientSessionto use with this change stream.withEventTypeThe type that the entire change stream response will be decoded to and that will be returned when iterating through the change stream. Return ValueAn EventLoopFuture<ChangeStream>. On success, contains aChangeStreamwatching all collections in this database.If the future fails, the error is likely one of the following: - MongoError.CommandErrorif an error occurs on the server while creating the change stream.
- MongoError.InvalidArgumentErrorif the options passed formed an invalid combination.
- MongoError.InvalidArgumentErrorif the- _idfield is projected out of the change stream documents by the pipeline.
 
 View on GitHub
            View on GitHub
           Install in Dash
            Install in Dash
           MongoDatabase Structure Reference
      MongoDatabase Structure Reference