with mongodb and rest activated, i would like to query a document inside another document, what is the syntax ? In my exemple, I have a Person collection which contains an Order document for each Person.
Ex, I have this schema
public Person{
public int Id {get;set;}
public IList<Order> Order {get;set;}
}
public Order{
public int Id {get;set;}
public string OrderName {get;set;}
}
If I want to query the person with Id = 2, I just need to type this URL:
http://localhost:28017/MyDatabase/PersonCollection/?filter_Id=2
But what If I want to query the Order with Id = 40 ?
http://localhost:28017/MyDatabase/PersonCollection/?filter_Order.Id=40
But It doesn’t work, it returns all the orders without my filter by Id=40.
What’s the solution ?
Thanks
John
Syntax the same as usual, so following request should work:
But yout document should looks like this: