-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