0
我有一个当前正在RavenDb 2.5上运行的应用程序。昨天我尝试将它移动到RavenDb 3(3.0.3599,服务器和客户端),并注意到很多单元测试失败。事实上,许多使用日期作为查询参数的测试失败了。通过失败我的意思是返回零结果,其中一个或多个预期。它看起来像查询 比较日期与大于或等于运营商>=
失败,但小于或等于<=
作品。带日期参数的查询不会返回RavenDB中的预期结果
针对同一索引的其他查询按预期工作。
一个典型的指数看起来是这样的:
public class GetBidListIndex : AbstractIndexCreationTask<Product, GetBidListIndex.Result>
{
public GetBidListIndex()
{
this.Map = docs => from p in docs
from b in p.Bids
select
new Result
{
BidId = b.BidId,
CustomerNumber = b.CustomerNumber,
BasePrice = b.BasePrice,
BidValidTo = b.ValidTo,
Country = b.Country
};
this.StoreAllFields(FieldStorage.Yes);
}
public class Result
{
public string BidId { get; set; }
public string CustomerNumber { get; set; }
public decimal? BasePrice { get; set; }
public DateTime? BidValidTo { get; set; }
public string Country { get; set; }
}
}
和典型查询如下所示:
RavenQueryStatistics stats;
this.Query = this.documentSession.Query<GetBidListIndex.Result, GetBidListIndex>().Statistics(out stats);
this.Query = from q in this.Query where q.BidValidTo >= bidValidFrom select q;
var result = this.Query
.ProjectFromIndexFieldsInto<GetBidListIndex.Result>()
.Skip(this.PageSize * (this.Page - 1))
.Take(this.PageSize)
.ToList();
数据库,并与每个测试的所有测试数据被重新生成,所以没有潜在的旧数据。
我找不出是什么原因造成这种情况。是否有其他人遇到这种行为?
“失败”是什么意思?怎么了? – 2015-02-11 14:04:35
我编辑了我的问题,现在就包括这个。 – Pelle 2015-02-12 09:42:02