3

I have the following issue - how to check is there are any element from int array mailListIds contains in MailLists in MailListId field. 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 ?

Vladyslav Furdak
  • 1,765
  • 2
  • 22
  • 46
  • Builders.Filter.In(p => p.MailLists[-1].MailListId, mailListIds) - It generates something like "p2l.$.listId" : { "$in" : [43156] } but i need the same without '$' – Vladyslav Furdak Aug 19 '15 at 12:04

1 Answers1

1

I've solved the problem by the following way :

 Builders<Profile>.Filter.Where(p => p.MailLists.Any(b => mailListIds.Contains(b.MailListId)))
Vladyslav Furdak
  • 1,765
  • 2
  • 22
  • 46