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
Exemplo n.º 1
0
 // check if the uploaded file integrity
 private void checkFileIntegrity(MongoGridFS grid, string id, BsonDocument metadata)
 {
     Console.Write("Checking file upload integrity: ");
     var downloadInfo = grid.FindOneById(ObjectId.Parse(id));
     var downloadMD5 = getMD5(downloadInfo.OpenRead());
     if (metadata["md5"] == downloadMD5)
         Console.WriteLine("PASS");
     else
         Console.WriteLine("FAIL");
 }