1
在使用C#2.0驅動程序的MongoDB 3.0中,如何從文檔的子文檔數組中獲得使用DistinctAsync
的不同值列表?DistinctAsync使用MongoDB C#2.0驅動程序對陣列子文檔
我在尋找的C#相當於本在外殼:
db.cars.distinct("parts.name", {"make":"Ford"})
承認失敗後,我使出這個殼上下的代碼:
var distinctParts = await db.RunCommandAsync<BsonDocument>(new BsonDocument {
{ "distinct", "cars"},
{"key", "parts.name"},
{"query", new BsonDocument { { "make", "Ford" }} } });
謝謝!
什麼'等待db.DistinctAsync(...)'是不是爲你工作,什麼錯誤(S)它產生? –
Alex