C# Class MongoDB.Driver.GridFS.MongoGridFS

Represents a GridFS file system.
Mostrar archivo Open project: Qiredev/mongo-csharp-driver Class Usage Examples

Public Methods

Method Description
AppendText ( string remoteFileName ) : StreamWriter

Appends UTF-8 encoded text to an existing GridFS file.

CopyTo ( string sourceFileName, string destFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Copies a GridFS file.

CopyTo ( string sourceFileName, string destFileName, MongoGridFSCreateOptions createOptions ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Copies a GridFS file.

Create ( string remoteFileName ) : MongoGridFSStream

Creates or overwrites a GridFS file.

Create ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream

Creates or overwrites a GridFS file.

CreateText ( string remoteFileName ) : StreamWriter

Creates or opens a GridFS file for writing UTF-8 encoded text.

CreateText ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : StreamWriter

Creates or opens a GridFS file for writing UTF-8 encoded text.

Delete ( IMongoQuery query ) : void

Deletes GridFS files.

Delete ( string remoteFileName ) : void

Deletes all versions of a GridFS file.

DeleteById ( BsonValue id ) : void

Deletes a GridFS file.

Download ( Stream stream, IMongoQuery query ) : void

Downloads the most recent version of a GridFS file.

Download ( Stream stream, IMongoQuery query, int version ) : void

Downloads a specific version of a GridFS file.

Download ( Stream stream, MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo ) : void

Downloads a GridFS file.

Download ( Stream stream, string remoteFileName ) : void

Downloads the most recent version of a GridFS file.

Download ( Stream stream, string remoteFileName, int version ) : void

Downloads a specific version of a GridFS file.

Download ( string fileName ) : void

Downloads the most recent version of a GridFS file.

Download ( string localFileName, IMongoQuery query ) : void

Downloads the most recent version of a GridFS file.

Download ( string localFileName, IMongoQuery query, int version ) : void

Downloads a specific version of a GridFS file.

Download ( string localFileName, MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo ) : void

Downloads a GridFS file.

Download ( string fileName, int version ) : void

Downloads a specific version of a GridFS file.

Download ( string localFileName, string remoteFileName ) : void

Downloads the most recent version of a GridFS file.

Download ( string localFileName, string remoteFileName, int version ) : void

Downloads a specific version of a GridFS file.

EnsureIndexes ( ) : void

Ensures that the proper indexes for GridFS exist (only creates the new indexes if there are fewer than 1000 GridFS files).

EnsureIndexes ( int maxFiles ) : void

Ensures that the proper indexes for GridFS exist.

Exists ( IMongoQuery query ) : bool

Tests whether a GridFS file exists.

Exists ( string remoteFileName ) : bool

Tests whether a GridFS file exists.

ExistsById ( BsonValue id ) : bool

Tests whether a GridFS file exists.

Find ( IMongoQuery query ) : MongoCursor

Finds matching GridFS files.

Find ( string remoteFileName ) : MongoCursor

Finds matching GridFS files.

FindAll ( ) : MongoCursor

Finds all GridFS files.

FindOne ( IMongoQuery query ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Finds the most recent version of a GridFS file.

FindOne ( IMongoQuery query, int version ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Finds a specific version of a GridFS file.

FindOne ( string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Finds the most recent version of a GridFS file.

FindOne ( string remoteFileName, int version ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Finds a specific version of a GridFS file.

FindOneById ( BsonValue id ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Finds a GridFS file.

MongoGridFS ( MongoDatabase database ) : System

Initializes a new instance of the MongoGridFS class.

MongoGridFS ( MongoDatabase database, MongoDB.Driver.GridFS.MongoGridFSSettings settings ) : System

Initializes a new instance of the MongoGridFS class.

MoveTo ( string sourceFileName, string destFileName ) : void

Moves the most recent version of a GridFS file.

Open ( string remoteFileName, FileMode mode ) : MongoGridFSStream

Opens a GridFS file with the specified mode.

Open ( string remoteFileName, FileMode mode, FileAccess access ) : MongoGridFSStream

Opens a GridFS file with the specified mode and access.

Open ( string remoteFileName, FileMode mode, FileAccess access, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream

Opens a GridFS file with the specified mode, access and create options.

OpenRead ( string remoteFileName ) : MongoGridFSStream

Opens an existing GridFS file for reading.

OpenText ( string remoteFileName ) : StreamReader

Opens an existing UTF-8 encoded text GridFS file for reading.

OpenWrite ( string remoteFileName ) : MongoGridFSStream

Opens an existing GridFS file for writing.

OpenWrite ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream

Opens an existing GridFS file for writing.

SetAliases ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, string aliases ) : void

Sets the aliases for an existing GridFS file.

SetContentType ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, string contentType ) : void

Sets the content type for an existing GridFS file.

SetMetadata ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, BsonValue metadata ) : void

Sets the metadata for an existing GridFS file.

Upload ( Stream stream, string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Uploads a GridFS file.

Upload ( Stream stream, string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Uploads a GridFS file.

Upload ( string fileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Uploads a GridFS file.

Upload ( string localFileName, string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo

Uploads a GridFS file.

Method Details

AppendText() public method

Appends UTF-8 encoded text to an existing GridFS file.
public AppendText ( string remoteFileName ) : StreamWriter
remoteFileName string The remote file name.
return System.IO.StreamWriter

CopyTo() public method

Copies a GridFS file.
public CopyTo ( string sourceFileName, string destFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
sourceFileName string The source file name.
destFileName string The destination file name.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

CopyTo() public method

Copies a GridFS file.
public CopyTo ( string sourceFileName, string destFileName, MongoGridFSCreateOptions createOptions ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
sourceFileName string The source file name.
destFileName string The destination file name.
createOptions MongoGridFSCreateOptions The create options.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

Create() public method

Creates or overwrites a GridFS file.
public Create ( string remoteFileName ) : MongoGridFSStream
remoteFileName string The remote file name.
return MongoGridFSStream

Create() public method

Creates or overwrites a GridFS file.
public Create ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream
remoteFileName string The remote file name.
createOptions MongoGridFSCreateOptions The create options.
return MongoGridFSStream

CreateText() public method

Creates or opens a GridFS file for writing UTF-8 encoded text.
public CreateText ( string remoteFileName ) : StreamWriter
remoteFileName string The remote file name.
return System.IO.StreamWriter

CreateText() public method

Creates or opens a GridFS file for writing UTF-8 encoded text.
public CreateText ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : StreamWriter
remoteFileName string The remote file name.
createOptions MongoGridFSCreateOptions The create options.
return System.IO.StreamWriter

Delete() public method

Deletes GridFS files.
public Delete ( IMongoQuery query ) : void
query IMongoQuery A query that specifies the GridFS files to delete.
return void

Delete() public method

Deletes all versions of a GridFS file.
public Delete ( string remoteFileName ) : void
remoteFileName string The remote file name.
return void

DeleteById() public method

Deletes a GridFS file.
public DeleteById ( BsonValue id ) : void
id BsonValue The GridFS file Id.
return void

Download() public method

Downloads the most recent version of a GridFS file.
public Download ( Stream stream, IMongoQuery query ) : void
stream Stream The destination stream.
query IMongoQuery The GridFS file.
return void

Download() public method

Downloads a specific version of a GridFS file.
public Download ( Stream stream, IMongoQuery query, int version ) : void
stream Stream The destination stream.
query IMongoQuery The GridFS file.
version int The version to download.
return void

Download() public method

Downloads a GridFS file.
public Download ( Stream stream, MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo ) : void
stream Stream The destination stream.
fileInfo MongoDB.Driver.GridFS.MongoGridFSFileInfo The GridFS file.
return void

Download() public method

Downloads the most recent version of a GridFS file.
public Download ( Stream stream, string remoteFileName ) : void
stream Stream The destination stream.
remoteFileName string The remote file name.
return void

Download() public method

Downloads a specific version of a GridFS file.
public Download ( Stream stream, string remoteFileName, int version ) : void
stream Stream The destination stream.
remoteFileName string The remote file name.
version int The version to download.
return void

Download() public method

Downloads the most recent version of a GridFS file.
public Download ( string fileName ) : void
fileName string The file name (same local and remote names).
return void

Download() public method

Downloads the most recent version of a GridFS file.
public Download ( string localFileName, IMongoQuery query ) : void
localFileName string The local file name.
query IMongoQuery The GridFS file.
return void

Download() public method

Downloads a specific version of a GridFS file.
public Download ( string localFileName, IMongoQuery query, int version ) : void
localFileName string The local file name.
query IMongoQuery The GridFS file.
version int The version to download.
return void

Download() public method

Downloads a GridFS file.
public Download ( string localFileName, MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo ) : void
localFileName string The local file name.
fileInfo MongoDB.Driver.GridFS.MongoGridFSFileInfo The GridFS file.
return void

Download() public method

Downloads a specific version of a GridFS file.
public Download ( string fileName, int version ) : void
fileName string The file name (same local and remote names).
version int The version to download.
return void

Download() public method

Downloads the most recent version of a GridFS file.
public Download ( string localFileName, string remoteFileName ) : void
localFileName string The local file name.
remoteFileName string The remote file name.
return void

Download() public method

Downloads a specific version of a GridFS file.
public Download ( string localFileName, string remoteFileName, int version ) : void
localFileName string The local file name.
remoteFileName string The remote file name.
version int The version to download.
return void

EnsureIndexes() public method

Ensures that the proper indexes for GridFS exist (only creates the new indexes if there are fewer than 1000 GridFS files).
public EnsureIndexes ( ) : void
return void

EnsureIndexes() public method

Ensures that the proper indexes for GridFS exist.
public EnsureIndexes ( int maxFiles ) : void
maxFiles int Only create new indexes if there are fewer than this number of GridFS files).
return void

Exists() public method

Tests whether a GridFS file exists.
public Exists ( IMongoQuery query ) : bool
query IMongoQuery The GridFS file.
return bool

Exists() public method

Tests whether a GridFS file exists.
public Exists ( string remoteFileName ) : bool
remoteFileName string The GridFS file.
return bool

ExistsById() public method

Tests whether a GridFS file exists.
public ExistsById ( BsonValue id ) : bool
id BsonValue The GridFS file.
return bool

Find() public method

Finds matching GridFS files.
public Find ( IMongoQuery query ) : MongoCursor
query IMongoQuery A query.
return MongoCursor

Find() public method

Finds matching GridFS files.
public Find ( string remoteFileName ) : MongoCursor
remoteFileName string The remote file name.
return MongoCursor

FindAll() public method

Finds all GridFS files.
public FindAll ( ) : MongoCursor
return MongoCursor

FindOne() public method

Finds the most recent version of a GridFS file.
public FindOne ( IMongoQuery query ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
query IMongoQuery The GridFS file.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

FindOne() public method

Finds a specific version of a GridFS file.
public FindOne ( IMongoQuery query, int version ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
query IMongoQuery The GridFS file.
version int The version to find.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

FindOne() public method

Finds the most recent version of a GridFS file.
public FindOne ( string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
remoteFileName string The remote file name.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

FindOne() public method

Finds a specific version of a GridFS file.
public FindOne ( string remoteFileName, int version ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
remoteFileName string The remote file name.
version int The version to find.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

FindOneById() public method

Finds a GridFS file.
public FindOneById ( BsonValue id ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
id BsonValue The GridFS file Id.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

MongoGridFS() public method

Initializes a new instance of the MongoGridFS class.
public MongoGridFS ( MongoDatabase database ) : System
database MongoDatabase The database containing the GridFS collections.
return System

MongoGridFS() public method

Initializes a new instance of the MongoGridFS class.
public MongoGridFS ( MongoDatabase database, MongoDB.Driver.GridFS.MongoGridFSSettings settings ) : System
database MongoDatabase The database containing the GridFS collections.
settings MongoDB.Driver.GridFS.MongoGridFSSettings The GridFS settings.
return System

MoveTo() public method

Moves the most recent version of a GridFS file.
public MoveTo ( string sourceFileName, string destFileName ) : void
sourceFileName string The source file name.
destFileName string The destination file name.
return void

Open() public method

Opens a GridFS file with the specified mode.
public Open ( string remoteFileName, FileMode mode ) : MongoGridFSStream
remoteFileName string The remote file name.
mode FileMode The mode.
return MongoGridFSStream

Open() public method

Opens a GridFS file with the specified mode and access.
public Open ( string remoteFileName, FileMode mode, FileAccess access ) : MongoGridFSStream
remoteFileName string The remote file name.
mode FileMode The mode.
access FileAccess The access.
return MongoGridFSStream

Open() public method

Opens a GridFS file with the specified mode, access and create options.
public Open ( string remoteFileName, FileMode mode, FileAccess access, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream
remoteFileName string The remote file name.
mode FileMode The mode.
access FileAccess The access.
createOptions MongoGridFSCreateOptions The create options.
return MongoGridFSStream

OpenRead() public method

Opens an existing GridFS file for reading.
public OpenRead ( string remoteFileName ) : MongoGridFSStream
remoteFileName string The remote file name.
return MongoGridFSStream

OpenText() public method

Opens an existing UTF-8 encoded text GridFS file for reading.
public OpenText ( string remoteFileName ) : StreamReader
remoteFileName string The remote file name.
return System.IO.StreamReader

OpenWrite() public method

Opens an existing GridFS file for writing.
public OpenWrite ( string remoteFileName ) : MongoGridFSStream
remoteFileName string The remote file name.
return MongoGridFSStream

OpenWrite() public method

Opens an existing GridFS file for writing.
public OpenWrite ( string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoGridFSStream
remoteFileName string The remote file name.
createOptions MongoGridFSCreateOptions The create options.
return MongoGridFSStream

SetAliases() public method

Sets the aliases for an existing GridFS file.
public SetAliases ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, string aliases ) : void
fileInfo MongoDB.Driver.GridFS.MongoGridFSFileInfo The GridFS file.
aliases string The aliases.
return void

SetContentType() public method

Sets the content type for an existing GridFS file.
public SetContentType ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, string contentType ) : void
fileInfo MongoDB.Driver.GridFS.MongoGridFSFileInfo The GridFS file.
contentType string The content type.
return void

SetMetadata() public method

Sets the metadata for an existing GridFS file.
public SetMetadata ( MongoDB.Driver.GridFS.MongoGridFSFileInfo fileInfo, BsonValue metadata ) : void
fileInfo MongoDB.Driver.GridFS.MongoGridFSFileInfo The GridFS file.
metadata BsonValue The metadata.
return void

Upload() public method

Uploads a GridFS file.
public Upload ( Stream stream, string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
stream Stream The source stream.
remoteFileName string The remote file name.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

Upload() public method

Uploads a GridFS file.
public Upload ( Stream stream, string remoteFileName, MongoGridFSCreateOptions createOptions ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
stream Stream The source stream.
remoteFileName string The remote file name.
createOptions MongoGridFSCreateOptions The create options.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

Upload() public method

Uploads a GridFS file.
public Upload ( string fileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
fileName string The file name (same local and remote names).
return MongoDB.Driver.GridFS.MongoGridFSFileInfo

Upload() public method

Uploads a GridFS file.
public Upload ( string localFileName, string remoteFileName ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
localFileName string The local file name.
remoteFileName string The remote file name.
return MongoDB.Driver.GridFS.MongoGridFSFileInfo