【发布时间】:2011-06-30 04:08:12
【问题描述】:
我正在 win64 机器上测试 MongoDB 1.6.5 的速度和 C#。我使用Yahoo.geoplanet 作为加载州、县、城镇的来源,但我的表现不是很好。我目前有更多 5 秒的时间从这些源加载美国各州,并将列表传递到 localhost 中的网页。 仅使用 id 作为索引。有人可以建议执行方式。谢谢
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”?
标签: performance mongodb mongodb-.net-driver