Name Emrah olan kişilerin Surnamelerini döndürür
[code lang=”c”]
MongoServerSettings settings = new MongoServerSettings();
settings.Server = new MongoServerAddress("127.0.0.1", 27017);
MongoServer mongo = MongoServer.Create();
mongo.Connect();
var db = mongo.GetDatabase("Test");
using (mongo.RequestStart(db))
{
var collection = db.GetCollection<BsonDocument>("Person");
var query = Query.EQ("Name", "Emrah");
foreach (BsonDocument prsn in collection.Find(query))
{
String surname = prsn["Surname"].ToString();
}
mongo.Disconnect();
}