In RavenDB 4.0+ for a given Sample Northwind database (which is also available at http://live-test.ravendb.net/), what RQL queries one may use to:
- Get Ordersin which at least one of theLineshasDiscount == 0?
- Get Ordersin which all theLineshaveDiscount != 0?
- Get Ordersin which at least one of theLineshasDiscount != 0?
- Get Ordersin which all theLineshaveDiscount == 0?
Here's a sample document structure:
{
    "Company": "companies/85-A",
    "Employee": "employees/5-A",
    "Freight": 32.38,
    "Lines": [
        {
            "Discount": 0,
            "PricePerUnit": 14,
            "Product": "products/11-A",
            "ProductName": "Queso Cabrales",
            "Quantity": 12
        },
        {
            "Discount": 0,
            "PricePerUnit": 9.8,
            "Product": "products/42-A",
            "ProductName": "Singaporean Hokkien Fried Mee",
            "Quantity": 10
        },
        {
            "Discount": 0,
            "PricePerUnit": 34.8,
            "Product": "products/72-A",
            "ProductName": "Mozzarella di Giovanni",
            "Quantity": 5
        }
    ],
    "OrderedAt": "1996-07-04T00:00:00.0000000",
    "RequireAt": "1996-08-01T00:00:00.0000000",
    "ShipTo": {
        "City": "Reims",
        "Country": "France",
        "Line1": "59 rue de l'Abbaye",
        "Line2": null,
        "Location": {
            "Latitude": 49.25595819999999,
            "Longitude": 4.1547448
        },
        "PostalCode": "51100",
        "Region": null
    },
    "ShipVia": "shippers/3-A",
    "ShippedAt": "1996-07-16T00:00:00.0000000",
    "@metadata": {
        "@collection": "Orders",
        "@flags": "HasRevisions",
        "@id": "orders/1-A",
        "@last-modified": "2018-07-27T12:11:53.0447651Z",
        "@change-vector": "A:417-EKrWjfz5kESi6lp7Nf442Q",
        "@index-score": 1
    }
}
I managed to find out some answers only for 1 and 2:
- Get Ordersin which at least one of theLineshasDiscount == 0?
- from Orders where Lines[].Discount == 0
- from Orders where Lines[].Discount IN (0)
- from Orders where Lines[].Discount ALL IN (0)
- Get Ordersin which all theLineshaveDiscount != 0?
- from Orders where Lines[].Discount != 0