[英]MongoDb c# driver 2.0 Any in many to many
I have the following issue - how to check is there are any element from int
array mailListIds
contains in MailLists
in MailListId
field. 我有以下问题-如何检查MailListId
字段的MailLists
中mailListIds
包含int
数组mailListIds
中的任何元素。 I think it could be something like the following : 我认为可能是以下情况:
Builders<Profile>.Filter.AnyIn(p => p.MailLists.Select(m => m.MailListId), mailListIds)
But that code cannot be serialized into query. 但是该代码无法序列化为查询。 How to implement it ? 如何执行呢?
我已经通过以下方式解决了这个问题:
Builders<Profile>.Filter.Where(p => p.MailLists.Any(b => mailListIds.Contains(b.MailListId)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.