1

I have mongo objects that follows the following pattern. Tags is an array of objects.

{
  "id" : "123",
  ...
  "Tags" : [{
      ...
      "first_name" : "jack",
      "last_name" : "john",
      "alive" : true 
  }]  
}

How do I query this so that I can get a list of objects which contain an object in the tags array who's first_name property and last_name property matches a given string using the C# Mongo Driver.

Anoop
  • 11
  • 2
  • Possible duplicate of [MongoDb c# driver find item in array by field value](https://stackoverflow.com/questions/31786220/mongodb-c-sharp-driver-find-item-in-array-by-field-value) – Aman B Mar 24 '18 at 16:58
  • No, its not. I tried the solution provided in the link mentioned by @Aman. But it returns objects which contain one object whose first_name matches but last_name and another object whose last_name matches but first_name – Anoop Mar 24 '18 at 19:24
  • you can do an and filter – Aman B Mar 25 '18 at 11:25
  • `Builders.Filter.And( firstnameFilter, lastNameFilter);` – Aman B Mar 25 '18 at 11:26

0 Answers0