PHP 클래스 yii\mongodb\file\Collection

A file collection object is usually created by calling [[Database::getFileCollection()]] or [[Connection::getFileCollection()]]. File collection inherits all interface from regular [[\yii\mongo\Collection]], adding methods to store files.
부터: 2.0
저자: Paul Klimov ([email protected])
상속: extends yii\mongodb\Collection
파일 보기 프로젝트 열기: yiisoft/yii2-mongodb 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$database MongoDB database instance.

공개 메소드들

메소드 설명
createDownload ( array | MongoDB\BSON\ObjectID $document ) : Download Creates download command.
createUpload ( array $options = [] ) : Upload Creates upload command.
delete ( mixed $id ) : boolean Deletes the file with given _id.
drop ( )
ensureIndexes ( boolean $force = false ) Makes sure that indexes, which are crucial for the file processing, exist at this collection and [[chunkCollection]].
find ( $condition = [], $fields = [], $options = [] ) : Cursor
get ( mixed $id ) : Download | null Retrieves the file with given _id.
getChunkCollection ( boolean $refresh = false ) : Collection Returns the MongoDB collection for the file chunks.
getFileCollection ( boolean $refresh = false ) : Collection Returns the MongoDB collection for the files.
getPrefix ( ) : string
insertFile ( string $filename, array $metadata = [], array $options = [] ) : mixed Creates new file in GridFS collection from given local filesystem file.
insertFileContent ( string $bytes, array $metadata = [], array $options = [] ) : mixed Creates new file in GridFS collection with specified content.
insertUploads ( string $name, array $metadata = [], array $options = [] ) : mixed Creates new file in GridFS collection from uploaded file.
remove ( $condition = [], $options = [] )
setPrefix ( string $prefix )

비공개 메소드들

메소드 설명
ensureChunkIndexes ( ) Ensures indexes at chunk collection.
ensureFileIndexes ( ) Ensures indexes at file collection.

메소드 상세

createDownload() 공개 메소드

Creates download command.
부터: 2.1
public createDownload ( array | MongoDB\BSON\ObjectID $document ) : Download
$document array | MongoDB\BSON\ObjectID file document ot be downloaded.
리턴 Download file download instance.

createUpload() 공개 메소드

Creates upload command.
부터: 2.1
public createUpload ( array $options = [] ) : Upload
$options array upload options.
리턴 Upload file upload instance.

delete() 공개 메소드

Deletes the file with given _id.
public delete ( mixed $id ) : boolean
$id mixed _id of the file to find.
리턴 boolean whether the operation was successful.

drop() 공개 메소드

public drop ( )

ensureIndexes() 공개 메소드

The check result is cached per collection instance.
public ensureIndexes ( boolean $force = false )
$force boolean whether to ignore internal collection instance cache.

find() 공개 메소드

public find ( $condition = [], $fields = [], $options = [] ) : Cursor
리턴 Cursor cursor for the search results

get() 공개 메소드

Retrieves the file with given _id.
public get ( mixed $id ) : Download | null
$id mixed _id of the file to find.
리턴 Download | null found file, or null if file does not exist

getChunkCollection() 공개 메소드

Returns the MongoDB collection for the file chunks.
public getChunkCollection ( boolean $refresh = false ) : Collection
$refresh boolean whether to reload the collection instance even if it is found in the cache.
리턴 yii\mongodb\Collection mongo collection instance.

getFileCollection() 공개 메소드

Returns the MongoDB collection for the files.
부터: 2.1
public getFileCollection ( boolean $refresh = false ) : Collection
$refresh boolean whether to reload the collection instance even if it is found in the cache.
리턴 yii\mongodb\Collection mongo collection instance.

getPrefix() 공개 메소드

public getPrefix ( ) : string
리턴 string prefix of this file collection.

insertFile() 공개 메소드

Additional attributes can be added file document using $metadata.
public insertFile ( string $filename, array $metadata = [], array $options = [] ) : mixed
$filename string name of the file to store.
$metadata array other metadata fields to include in the file document.
$options array list of options in format: optionName => optionValue
리턴 mixed the "_id" of the saved file document. This will be a generated [[\MongoId]] unless an "_id" was explicitly specified in the metadata.

insertFileContent() 공개 메소드

Additional attributes can be added file document using $metadata.
public insertFileContent ( string $bytes, array $metadata = [], array $options = [] ) : mixed
$bytes string string of bytes to store.
$metadata array other metadata fields to include in the file document.
$options array list of options in format: optionName => optionValue
리턴 mixed the "_id" of the saved file document. This will be a generated [[\MongoId]] unless an "_id" was explicitly specified in the metadata.

insertUploads() 공개 메소드

Additional attributes can be added file document using $metadata.
public insertUploads ( string $name, array $metadata = [], array $options = [] ) : mixed
$name string name of the uploaded file to store. This should correspond to the file field's name attribute in the HTML form.
$metadata array other metadata fields to include in the file document.
$options array list of options in format: optionName => optionValue
리턴 mixed the "_id" of the saved file document. This will be a generated [[\MongoId]] unless an "_id" was explicitly specified in the metadata.

remove() 공개 메소드

public remove ( $condition = [], $options = [] )

setPrefix() 공개 메소드

public setPrefix ( string $prefix )
$prefix string prefix of this file collection.

프로퍼티 상세

$database 공개적으로 프로퍼티

MongoDB database instance.
public $database