FindOneById() public méthode

Finds a GridFS file.
public FindOneById ( BsonValue id ) : MongoDB.Driver.GridFS.MongoGridFSFileInfo
id BsonValue The GridFS file Id.
Résultat MongoDB.Driver.GridFS.MongoGridFSFileInfo
Exemple #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");
 }