我有這樣的DocumentDB爲了在DocumentDB結果
{
"Code": "123456",
"ScanLog": [
{
"TimeStamp": 20160224115507
},
{
"TimeStamp": 20160224115641
}
]
"LastScanTimeStamp": 20160224115641
}
我在C#使這個LINQ查詢一些文件:
var Query = client.CreateDocumentQuery().OrderByDescending(c => c.LastScanTimeStamp).SelectMany(a => a.ScanLog.Select(b => new { Code = a.Code, TimeStamp = b.TimeStamp })).AsDocumentQuery();
var feedResp = await Query.ExecuteNextAsync();
,這是結果:
[
{
"Code": "123456",
"TimeStamp": 20160224115507
},
{
"Code": "123456",
"TimeStamp": 20160224115641
},
{
"Code": "abcdef",
"TimeStamp": 20160224101641
},
{
"Code": "abcdef",
"TimeStamp": 20160224105641
}
]
對於這個結果,我以這種方式申請另一個訂單:
feedResp.OrderByDescending(a => a.TimeStamp).AsEnumerable();
的響應是:
[
{
"Code": "123456",
"TimeStamp": 20160224115641
},
{
"Code": "123456",
"TimeStamp": 20160224115507
},
{
"Code": "abcdef",
"TimeStamp": 20160224105641
},
{
"Code": "abcdef",
"TimeStamp": 20160224101641
}
]
現在,如果我使與指定所述檢索到的項目的限制LINQ操作者採取()初始查詢,我失去了在結果的一些元素。 爲什麼?
您的原始回覆有4個結果。您爲Take指定了什麼值?如果它小於4,你顯然會得到更少的結果。 –