title: Web API Get with query parameters on Mongodb collection
body: <p>I have WebAPI written and it is using mongodb collection as a database.
  it looks like</p>
  
  <pre><code>[
     {
        "Id":"5a449c148b021b5fb4cb1f66",
        "airline":[
           {
              "airlineID":-1,
              "airlineName":"Unknown",
              "airlineAlias":"",
              "airlineIATACode":"-",
              "airlineICAOCode":"N/A",
              "airlineCallsign":"",
              "airlineBaseCountry":"",
              "airlineActiveIndicator":"Y"
           },
           {
              "airlineID":1,
              "airlineName":"Private flight",
              "airlineAlias":"",
              "airlineIATACode":"1T",
              "airlineICAOCode":"N/A",
              "airlineCallsign":"",
              "airlineBaseCountry":"",
              "airlineActiveIndicator":"Y"
           },
           {
              "airlineID":2,
              "airlineName":"135 Airways",
              "airlineAlias":"",
              "airlineIATACode":"2T",
              "airlineICAOCode":"GNL",
              "airlineCallsign":"GENERAL",
              "airlineBaseCountry":"United States",
              "airlineActiveIndicator":"N"
           }
        ]
     }
  ]
  </code></pre>
  
  <p>I'm trying to get data using airlineIATACode attribute</p>
  
  <pre><code>public airlineModel Get(string i)
          {           
              _collection = _db.GetCollection&lt;airlineModel&gt;("airline");
  
              var res = Query&lt;airlineModel&gt;.EQ(p =&gt; p.airline[0].airlineIATACode, i);            
              return _collection.FindOne(res);
          } 
  </code></pre>
  
  <p>My controller implementation</p>
  
  <pre><code>public HttpResponseMessage Get(string IATAcode)
          {
              var result = objds.Get(IATAcode);
              if (result != null)
                  return Request.CreateResponse(HttpStatusCode.OK, result);
              return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Data not found");
  
          } 
  </code></pre>
  
  <p>My Model class:</p>
  
  <pre><code>public class airlineModel
      {
          public ObjectId Id { get; set; }
  
          [BsonElement("airline")]
          public List&lt;airlinedata&gt; airline { get; set; }
      }
  
  
  
  public class airlinedata
  {
      [BsonElement("airlineID")]
      public int airlineID { get; set; }
      [BsonElement("airlineName")]
      public string airlineName { get; set; }
      [BsonElement("airlineAlias")]
      public string airlineAlias { get; set; }
     [BsonElement("airlineIATACode")]
      public string airlineIATACode { get; set; }
      [BsonElement("airlineICAOCode")]
      public string airlineICAOCode { get; set; }
      [BsonElement("airlineCallsign")]
      public string airlineCallsign { get; set; }
      [BsonElement("airlineBaseCountry")]
      public string airlineBaseCountry { get; set; }
      [BsonElement("airlineActiveIndicator")]
      public string airlineActiveIndicator { get; set; }
  }
  </code></pre>
  
  <p>When I run app and browse <a href="http://localhost:60387/api/airlineAPI?IATAcode=1T" rel="nofollow noreferrer">http://localhost:60387/api/airlineAPI?IATAcode=1T</a></p>
  
  <p>it says, Data not found</p>
  
  <p>What can I do to solve this problem?</p>