java - Receive entity by newest created first on Google App Engine -
i'm using android , built project google app engine. when receive list of entities come me first created. need them come in opposite direction, or 100 newest. can put limit on how many receive actually. cannot find on google or stackoverflow. has questions or examples on this. quick help?
you want commit dateproperty field index=true , auto_now_add=true. can sort descending on field fetch limit. there may slicker ways, tried , true.
imho - idea include date_created property on every important entity. whether or not index depends on use. noted tomasz, entity ids - while ascending - not guaranteed so. not rely on them. if ever find needing progress sequentially though model, happy have "datec" field. (also idea include "version" integerproperty on every record proves useful whenever need read/write way through existing entities ensure recent property change applied them all.) given these potential benefits, ask costs keep ending each model these 2 properties. {note: indexing real cost, not set index=true these fields unless plan use it.)
datec = ndb.datetimeproperty(indexed=true, auto_now_add=true) v = ndb.integerproperty(indexed=false, default=1)
| no way row id in consecutive order? don't have db defined? google app engine have models , endpoint classes. that's why i'm having trouble finding example on how use cursor – nightskycode jul 22 '13 @ 15:48 | ||
| ids not monotonically increasing values. wishes were, not. many, many questions , threads spent covering on years. unfortunately, before knowing this, can conclude otherwise examining ids during development , testing since increase monotonically. – stevep jul 22 '13 @ 17:58 |
you can add | |||||||||
|