I found a lot of examples of how do use $in in the previous mongodb c# driver, but I can not find any examples on how to do it in the 2.0 version.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use the AnyIn
operator for the typed version:
Builders<TDocument>.Filter.AnyIn(x => x.Array,searchArray)
回答2:
I was able to figure it out. Here is how to define the Bson document for the Find method:
BsonDocument bson = new BsonDocument("_id", new BsonDocument("$in", new BsonArray(vins)));
回答3:
Or, how about this
var ft = new BsonDocument("ListOfString", new BsonDocument("$in", varString));
var result = myContext.myPOCO.Find(ft);