google app engine - Cloud Endpoints calculated an Entity property at query time -


how can have property in entity calculated @ query time?

for example if had post entity , did getpost(long postid), mypost.likes property calculated @ moment getting count of how many like entities there specific post key.

or

if not possible, considering storing int likes property each post entity increment 1 every time new like inserted.

both work. latter use sharding counters if expect many lps (likes per second). use first approach though since can have meta like, when created, whom, etc.

there's no real @ query time calculation that. have write query sum likes yourself. in objectify use @onload annotation query each post, after query. recommend don't though since query each returned post of query. should manually avoid redundant queries likes when don't need them.


Comments