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