How can I query the AppEngine database by comparing two properties of the same object?

I would like to make a request to return all entities of a given type where one property is larger than another. For example, return all widgets where the sale price is greater than the purchase price. I cannot figure out how to do this in the Google AppEngine datastore.

+3
source share
1 answer

You cannot do this directly, because the indexing model does not support complex expressions. You will need to add a new property that you manually maintain, like the difference between the purchase and sale prices, and then look for elements where this delta property is greater or less than zero.

+5
source

Source: https://habr.com/ru/post/1787961/


All Articles