Foo for getting objects where prop1 = prop2

I’m writing an Ontology function that returns a subset of an Object set, where the objects have property 1 = property 2.

Eg.

@Function()
    public getFulfilledOrders(): Promise<ObjectSet<PO>> {
        const fulfilledOrders = Objects.search().PO().filter(order => 
            (order.quantityOrdered.exactMatch(order.quantityReceived)
        );
        return fulfilledOrders;
    }

I can’t get to seem the syntax working despite trying out different variations of this filter. Is it not possible to compare two different properties in a filter on an object set?

The alternative is to loop through the object set but that would likely be more computationally expensive.

the issue is that you return a Promise<> from a synchronous function. you have add the “async” to your function declaration or directly return the objectset