Instance Methodmongokitten 7.9.5MongoKitten
findFile(byId:)
Finds a single file in this GridFS bucket that matches `_id == id``.
GridFSBucket.swift:91func findFile(byId id: Primitive) async throws -> GridFSFile?
Parameters
- id
The
_id
of the file to find
Other members in extension
Type members
init(named: String, in: MongoDatabase
) Creates a new GridFSBucket for the given database and collection name (defaulting to “fs”)
static let defaultChunkSize: Int32
The default chunk size for GridFS files in bytes (255 kB)
Instance members
let chunksCollection: MongoCollection
The chunks collection for this GridFS bucket. This is where the actual file data is stored.
let filesCollection: MongoCollection
The files collection for this GridFS bucket. This is where the file metadata is stored.
func deleteFile(byId: Primitive
) async throws Deletes a file from GridFS and all of its chunks.
func find(Document
) -> MappedCursor<FindQueryBuilder, GridFSFile> Lists all files in this GridFS bucket that match the given query. The query is a MongoDB query document.
func find<MKQ>(MKQ
) -> MappedCursor<FindQueryBuilder, GridFSFile> Lists all files in this GridFS bucket that match the given query.
func findFile(Document
) async throws -> GridFSFile? Finds a single file in this GridFS bucket that matches the given query. The query is a MongoDB query document.
func findFile<MKQ>(MKQ
) async throws -> GridFSFile? Lists a single file in this GridFS bucket that match the given query.
func upload(Data, filename: String?, id: Primitive, metadata: Document?, chunkSize: Int32
) async throws -> GridFSFile Uploads a file to GridFS and returns the GridFSFile that was created for it.
func upload(ByteBuffer, filename: String?, id: Primitive, metadata: Document?, chunkSize: Int32
) async throws -> GridFSFile Uploads a file to GridFS and returns the GridFSFile that was created for it.