开发者

How are listproperty fields ordered in App Engine?

I am planning to store some data in a listproperty and want to be sure that the order of the items in the list remains the same when I query my entity back out. Is there such a guarantee when putting and getting data from the datastore?

To be clear, I am not trying to order a set of results by anything in the listproperty, I just want to make sure that if I have a list of strings (for example: "Sam", "Alberto", "Rick"), they are always in that order when I access that entity.

The answer to this question would imply that they do always stay the same, but I'd like to b开发者_如何转开发e sure: Use a ListProperty or custom tuple property in App Engine?


The statement from the documentation is:

Order is generally preserved, so when entities are returned by queries and get(), the list properties values are in the same order as when they were stored. There's one exception to this: Blob and Text values are moved to the end of the list; however, they retain their original order relative to each other.

(From http://code.google.com/appengine/docs/python/datastore/datamodeling.html)

So, if you are only storing strings, they should be returned in the correct order.


ListProperties work just like python lists; they are ordered and will remain ordered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜