Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GridFileInfo.Exists()

  • Loading branch information...
commit d4f72efb0786e35a4c8b3192ec33d03b97727ea7 1 parent 3b68126
Samuel Corder authored
View
11 MongoDB.GridFS.Tests/GridFileInfoTest.cs
@@ -74,7 +74,16 @@ public class GridFileInfoTest
Assert.IsFalse(gf.Exists(filename), "File should have been moved.");
Assert.IsTrue(gf.Exists(filename2), "File wasn't");
}
-
+
+ [Test]
+ public void TestFileExists(){
+ string filename = "gfi-exists.txt";
+ GridFileInfo gfi = new GridFileInfo(db["tests"], "gfexists", filename);
+ Assert.IsFalse(gfi.Exists());
+ GridFileStream gfs = gfi.Create();
+ Assert.IsTrue(gfi.Exists());
+ }
+
[Test]
public void TestOpenNonExistentFails(){
string filename = "gfi-opennothere.txt";
View
5 MongoDB.GridFS/GridFileInfo.cs
@@ -184,10 +184,15 @@ public string FileName
}
}
+
public void MoveTo(String newFileName){
this.gridFile.Move(this.FileName, newFileName);
}
+ public Boolean Exists(){
+ return this.gridFile.Exists(this.FileName);
+ }
+
public void Truncate(){
if(filedata.Contains("_id") == false) return;
this.gridFile.Chunks.Delete(new Document().Append("files_id", filedata["_id"]));
View
7 README.rst
@@ -23,13 +23,13 @@ Current Features
- GridFS support
- Map Reduce helpers.
- hint, explain, $where
+- Safemode
+- Exceptions
Missing Features
================
- Auto reconnect options
- Connection pooling (In progress)
-- Exceptions (In progress)
-- Safemode (Scheduled)
- database profiling: set/get profiling level, get profiling info
- Many unit tests
@@ -63,7 +63,6 @@ Contributors
- Sam Corder (samus)
- Seth Edwards (Sedward)
- Arne Classen (Sdether)
+- Steve Wagner (lanwin)
- Andrew Kempe
- Sergey Bartunov (sbos)
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.