我有一个将“标签”作为数组对象的集合。现在我想使用构建器在 C# 中进行查询。
我需要创建一个查询,我将在标签中传递值,例如 -
(T1 或 T2) 和 (T3 或 T4 或 T5 或 T6)
怎么样.And(
用.AnyIn(
?
IMongoCollection<Model> collection;
var builder = Builders<Model>.Filter;
var result = collection.Find(
builder.And(
builder.AnyIn(m => m.Tags, new [] { "T1", "T2" },
builder.AnyIn(m => m.Tags, new[] { "T3", "T4", "T5", "T6" }
)
);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句