-1
我有以下查詢:查詢到C#MongoDB中3.2
db.products.find({name: "4-Year Protection Plan - Geek Squad"}, {name: 1, sku: 1}).limit(10)
我怎樣才能把它翻譯成C#?
我有以下查詢:查詢到C#MongoDB中3.2
db.products.find({name: "4-Year Protection Plan - Geek Squad"}, {name: 1, sku: 1}).limit(10)
我怎樣才能把它翻譯成C#?
確定 - 找到了答案:
var filter = Builders<BsonDocument>.Filter.Eq("name", "4-Year Protection Plan - Geek Squad");
var sort = Builders<BsonDocument>.Sort.Descending("name");
var fields = Builders<BsonDocument>.Projection.Include("name").Include("sku");
var c = collection.Find(filter).Sort(sort).Project(fields).Limit(10).Count();
確定 - 找到了答案: VAR字段=助洗劑 .Projection.Include( 「名稱」),可列舉( 「SKU」);。 var c = collection.Find(filter).Sort(sort).Project(fields).Limit(10); –
bkl