Skip to content

query the example of 'complex-resource' #69

@shoringfan10

Description

@shoringfan10

I have tried to add some mock data for the complex-resource example, which has its structure as,

var order = {
  custom: {
    id: String,
    name: String
  },
  orderItems: [{
    quantity: Number,
    product: {
      id: String,
      name: String,
      price: Number
    }
  }]
};

The question is, how can I get the result that the orderItems have their products with the prices higher than 10.00, for example?

I have tried the queries like, without luck.

1. GET orders?$filter=price gt 10
2. GET orders?$filter=product/price gt 10
3. GET orders?$filter=orderItems/product/price gt 10

the results are always empty, was this a bug or something I was missing, any ideas?

{"value":[]}

The mock data:

{ "_id" : "fb107243-5f4d-4d47-8b35-245fa85127cd", "orderItems" : [ { "quantity" : 100, "_id" : ObjectId("57e303cdd70bda6419c9922d"), "product" : { "id" : "item123", "name" : "ITEMA", "price" : 10 } } ], "custom" : { "id" : "abc123", "name" : "ABC" } }
{ "_id" : "1c1ceeea-8c75-443e-8706-fa696ec5acf6", "orderItems" : [ { "quantity" : 200, "_id" : ObjectId("57e30426d70bda6419c9922e"), "product" : { "id" : "item234", "name" : "ITEMB", "price" : 15 } } ], "custom" : { "id" : "bcd123", "name" : "BCD" } }
{ "_id" : "a8dd0f23-46d9-4f6e-bffa-9709e7c23b87", "orderItems" : [ { "quantity" : 300, "_id" : ObjectId("57e30454d70bda6419c9922f"), "product" : { "id" : "item345", "name" : "ITEMC", "price" : 20 } } ], "custom" : { "id" : "efg123", "name" : "EFG" } }
{ "_id" : "316efd3f-0b30-4ad1-ac22-2640a613142e", "orderItems" : [ { "quantity" : 400, "_id" : ObjectId("57e30474d70bda6419c99230"), "product" : { "id" : "item456", "name" : "ITEMD", "price" : 30 } } ], "custom" : { "id" : "hij123", "name" : "HIJ" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions