MongoDB.GridFS.GridFile.Exists C# (CSharp) Метод

Exists() публичный Метод

Gets a value indicating whether the file exists.
public Exists ( Object id ) : System.Boolean
id Object
Результат System.Boolean
        public Boolean Exists(Object id)
        {
            return this.files.FindOne(new Document().Append("_id",id)) != null;
        }

Same methods

GridFile::Exists ( string name ) : System.Boolean

Usage Example

Пример #1
0
 public void TestCopy(){
     GridFile fs = new GridFile(DB, "gfcopy");
     GridFileStream gfs = fs.Create("original.txt");
     gfs.WriteByte(1);
     gfs.Seek(1024 * 256 * 2, SeekOrigin.Begin);
     gfs.WriteByte(2);
     gfs.Close();
     fs.Copy("original.txt", "copy.txt");
     Assert.IsTrue(fs.Exists("original.txt"));
     Assert.IsTrue(fs.Exists("copy.txt"));
     //TODO Assert chunk data is the same too.
 }
All Usage Examples Of MongoDB.GridFS.GridFile::Exists