Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Found this solution. Through the addition of Metadata.
var client = new MongoClient("mongodb://25.35.34.171:27017");
var db = client.GetServer();
var s = new MongoGridFSSettings();
// чтение из файла
using (FileStream fstream = File.OpenRead(@"C:\\Users\\Slide\\Pictures\\1268995974-dropdatabase.jpg"))
{
// преобразуем строку в байты
byte[] array = new byte[fstream.Length];
// считываем данные
fstream.Read(array, 0, array.Length);
var tt = new MongoGridFS(db, "ufanet", s);
var cro = new MongoGridFSCreateOptions();
cro.Metadata = new BsonDocument { { "name", "Bill" } };
var f = tt.Upload(fstream,"dropdatabase.jpg",cro);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question