I wonder if anybody has encountered the strange problem on Google App Engine's NDB: after creating a new entity and saving it by put()
; and then query()
immediately, there is always one less item. For example,
class Item(ndb.Model):
...
...
items = Item.query().fetch()
length1 = len(items)
item = Item()
item.put()
items = Item.query().fetch()
length2 = len(items)
In the above, length1
is always equal to length2
. However, length2
will be corrected when revisiting the same HTML page later. What is the problem? Thanks.