0
MongoDB C#で次のクエリを実行中に問題が発生しました。 mongoクライアントのコードはMongoDB C#Driverの "Or"ステートメントの使い方は?
db.collection.find({ $or: [ { quantity: { $lt: 20 } }, { price: 10 } ,{price:100},{name:"x"}] })
ですが、どのようにC#で同じ質問をするのですか? 私はモンゴCシャープドライバ1.9.2を使用しています
var match = new BsonDocument() { { "$match", new BsonDocument { {"type":"food" } } } };
var project = new BsonDocument(){ { "$project", new BsonDocument{ { "name", 1 } { "quantity", 1 } } } };
AggregateArgs AggregationPipeline = new AggregateArgs() { Pipeline = new[] { match, project } };
var aggregate = Collection.Aggregate(AggregationPipeline);
として次のmongoクライアントコード声明
db.collection.find({type:"food"},{name:1,quantity:1})
を照会することができました。おかげさまで
こんにちは@Mahdiを、私はMongoCSharpDriverを使用しています。 1.9.2。ビルダーのコンテキストはこのバージョンには存在しません。ありがとう – coder