我在win64機器上測試MongoDB 1.6.5速度和C#。我使用Yahoo.geoplanet作爲來源加載州,縣,城鎮,但我不是非常高性能。目前我有5秒多的時間從這些源代碼中加載美國各州,將列表傳遞給本地主機的網頁。 只使用id作爲索引。有人可以建議的方式來執行。由於MongoDB C#低性能問題
class BsonPlaces
{
[BsonId]
public String Id { get; set; }
public String Iso { get; set; }
public String Name { get; set; }
public String Language { get; set; }
public String Place_Type { get; set; }
public String Parent_Id { get; set; }
}
public List<BsonPlaces> Get_States(string UseCountry)
{
using (var helper = BsonHelper.Create())
{
var query = Query.EQ("Place_Type", "State");
if (!String.IsNullOrEmpty(UseCountry))
query = Query.And(query, Query.EQ("Iso", UseCountry));
var cursor = helper.GeoPlanet.PlacesRepository.Db.Places
.FindAs<BsonPlaces>(query);
if (!String.IsNullOrEmpty(UseCountry))
cursor.SetSortOrder(SortBy.Ascending("Name"));
return cursor.ToList();
}
}
通過查詢返回多少'BsonPlaces'? – 2011-02-18 23:19:06